bw_math: relax bw_sechf() requirements

This commit is contained in:
Stefano D'Angelo 2025-02-28 18:20:23 +01:00
parent c91dbd5c95
commit 5c185738c2
2 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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;