From: Jacob Lifshay Date: Fri, 14 May 2021 02:48:34 +0000 (-0700) Subject: add tan_pi X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=44ef5b89a4a4475f35891c1eb96c463fff6d1721;p=vector-math.git add tan_pi --- 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::*;