From 44ef5b89a4a4475f35891c1eb96c463fff6d1721 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Thu, 13 May 2021 19:48:34 -0700 Subject: [PATCH] add tan_pi --- src/algorithms/trig_pi.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/algorithms/trig_pi.rs b/src/algorithms/trig_pi.rs index e776378..5be0ad6 100644 --- a/src/algorithms/trig_pi.rs +++ b/src/algorithms/trig_pi.rs @@ -249,6 +249,27 @@ pub fn cos_pi_f64(ctx: Ctx, x: Ctx::VecF64) -> Ctx::VecF64 { sin_cos_pi_f64(ctx, x).1 } +/// computes `tan(pi * x)` +/// error inherited from `sin_pi / cos_pi` +pub fn tan_pi_f16(ctx: Ctx, x: Ctx::VecF16) -> Ctx::VecF16 { + let (sin, cos) = sin_cos_pi_f16(ctx, x); + sin / cos +} + +/// computes `tan(pi * x)` +/// error inherited from `sin_pi / cos_pi` +pub fn tan_pi_f32(ctx: Ctx, x: Ctx::VecF32) -> Ctx::VecF32 { + let (sin, cos) = sin_cos_pi_f32(ctx, x); + sin / cos +} + +/// computes `tan(pi * x)` +/// error inherited from `sin_pi / cos_pi` +pub fn tan_pi_f64(ctx: Ctx, x: Ctx::VecF64) -> Ctx::VecF64 { + let (sin, cos) = sin_cos_pi_f64(ctx, x); + sin / cos +} + #[cfg(test)] mod tests { use super::*; -- 2.30.2