From 97f26f99bb9a5ba4e4148607a434ccb06096fdfe Mon Sep 17 00:00:00 2001 From: falkTX Date: Thu, 23 Mar 2023 12:33:09 +0100 Subject: [PATCH] Use fabsf to ensure no double promotion Signed-off-by: falkTX --- src/dsp.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dsp.cpp b/src/dsp.cpp index 7f56735..9ae0a19 100644 --- a/src/dsp.cpp +++ b/src/dsp.cpp @@ -192,13 +192,13 @@ void sigmoid_(Eigen::MatrixXf &x, const long i_start, const long i_end, inline float fast_tanh_(const float x) { - const float ax = fabs(x); + const float ax = fabsf(x); const float x2 = x * x; return(x * (2.45550750702956f + 2.45550750702956f * ax + (0.893229853513558f + 0.821226666969744f * ax) * x2) / (2.44506634652299f + (2.44506634652299f + x2) * - fabs(x + 0.814642734961073f * x * ax))); + fabsf(x + 0.814642734961073f * x * ax))); } void tanh_(Eigen::MatrixXf& x)