bw_math: relax bw_sechf() requirements
This commit is contained in:
parent
c91dbd5c95
commit
5c185738c2
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Brickworks
|
* 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
|
* Brickworks is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -642,7 +642,7 @@ static inline float bw_sechf(
|
|||||||
/*! <<<```
|
/*! <<<```
|
||||||
* Returns an approximation of the hyperbolic secant of `x`.
|
* 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()
|
* #### bw_asinhf()
|
||||||
* ```>>> */
|
* ```>>> */
|
||||||
@ -1159,7 +1159,7 @@ static inline float bw_coshf(
|
|||||||
static inline float bw_sechf(
|
static inline float bw_sechf(
|
||||||
float x) {
|
float x) {
|
||||||
BW_ASSERT(!bw_is_nan(x));
|
BW_ASSERT(!bw_is_nan(x));
|
||||||
if (x * x >= 88.722f * 88.722f)
|
if (x * x >= 22.f * 22.f)
|
||||||
return 0.f;
|
return 0.f;
|
||||||
float y = bw_rcpf(bw_expf(x) + bw_expf(-x));
|
float y = bw_rcpf(bw_expf(x) + bw_expf(-x));
|
||||||
y = y + y;
|
y = y + y;
|
||||||
|
Loading…
Reference in New Issue
Block a user