bw_math: added bw_sechf()
This commit is contained in:
parent
d008662ffb
commit
c91dbd5c95
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Brickworks
|
* Brickworks
|
||||||
*
|
*
|
||||||
* Copyright (C) 2021-2024 Orastron Srl unipersonale
|
* Copyright (C) 2021-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
|
||||||
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
* module_type {{{ utility }}}
|
* module_type {{{ utility }}}
|
||||||
* version {{{ 1.1.0 }}}
|
* version {{{ 1.2.0 }}}
|
||||||
* requires {{{ bw_common }}}
|
* requires {{{ bw_common }}}
|
||||||
* description {{{
|
* description {{{
|
||||||
* A collection of mathematical routines that strive to be better suited to
|
* A collection of mathematical routines that strive to be better suited to
|
||||||
@ -44,6 +44,11 @@
|
|||||||
* }}}
|
* }}}
|
||||||
* changelog {{{
|
* changelog {{{
|
||||||
* <ul>
|
* <ul>
|
||||||
|
* <li>Version <strong>1.2.0</strong>:
|
||||||
|
* <ul>
|
||||||
|
* <li>Added <code>bw_sechf()</code>.</li>
|
||||||
|
* </ul>
|
||||||
|
* </li>
|
||||||
* <li>Version <strong>1.1.0</strong>:
|
* <li>Version <strong>1.1.0</strong>:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>Added <code>bw_signfilli64()</code>, <code>bw_mini64()</code>,
|
* <li>Added <code>bw_signfilli64()</code>, <code>bw_mini64()</code>,
|
||||||
@ -630,6 +635,15 @@ static inline float bw_coshf(
|
|||||||
*
|
*
|
||||||
* Relative error < 0.07%.
|
* Relative error < 0.07%.
|
||||||
*
|
*
|
||||||
|
* #### bw_sechf()
|
||||||
|
* ```>>> */
|
||||||
|
static inline float bw_sechf(
|
||||||
|
float x);
|
||||||
|
/*! <<<```
|
||||||
|
* Returns an approximation of the hyperbolic secant of `x`.
|
||||||
|
*
|
||||||
|
* Relative error < 0.07%.
|
||||||
|
*
|
||||||
* #### bw_asinhf()
|
* #### bw_asinhf()
|
||||||
* ```>>> */
|
* ```>>> */
|
||||||
static inline float bw_asinhf(
|
static inline float bw_asinhf(
|
||||||
@ -1142,6 +1156,17 @@ static inline float bw_coshf(
|
|||||||
return y;
|
return y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline float bw_sechf(
|
||||||
|
float x) {
|
||||||
|
BW_ASSERT(!bw_is_nan(x));
|
||||||
|
if (x * x >= 88.722f * 88.722f)
|
||||||
|
return 0.f;
|
||||||
|
float y = bw_rcpf(bw_expf(x) + bw_expf(-x));
|
||||||
|
y = y + y;
|
||||||
|
BW_ASSERT(bw_is_finite(y));
|
||||||
|
return y;
|
||||||
|
}
|
||||||
|
|
||||||
static inline float bw_asinhf(
|
static inline float bw_asinhf(
|
||||||
float x) {
|
float x) {
|
||||||
BW_ASSERT(bw_is_finite(x));
|
BW_ASSERT(bw_is_finite(x));
|
||||||
|
Loading…
Reference in New Issue
Block a user