From 5c185738c24b168d156968308d59f5ec9ebf4a10 Mon Sep 17 00:00:00 2001 From: Stefano D'Angelo Date: Fri, 28 Feb 2025 18:20:23 +0100 Subject: [PATCH] bw_math: relax bw_sechf() requirements --- include/bw_common.h | 2 +- include/bw_math.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/bw_common.h b/include/bw_common.h index 39f48de..f96eb7e 100644 --- a/include/bw_common.h +++ b/include/bw_common.h @@ -1,7 +1,7 @@ /* * Brickworks * - * Copyright (C) 2022-2024 Orastron Srl unipersonale + * Copyright (C) 2025 Orastron Srl unipersonale * * Brickworks is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/include/bw_math.h b/include/bw_math.h index 987cd2e..2c5bd80 100644 --- a/include/bw_math.h +++ b/include/bw_math.h @@ -642,7 +642,7 @@ static inline float bw_sechf( /*! <<<``` * Returns an approximation of the hyperbolic secant of `x`. * - * Relative error < 0.07%. + * Absolute error < 1e-9 or relative error < 0.07%, whatever is worse. * * #### bw_asinhf() * ```>>> */ @@ -1159,7 +1159,7 @@ static inline float bw_coshf( static inline float bw_sechf( float x) { BW_ASSERT(!bw_is_nan(x)); - if (x * x >= 88.722f * 88.722f) + if (x * x >= 22.f * 22.f) return 0.f; float y = bw_rcpf(bw_expf(x) + bw_expf(-x)); y = y + y;