diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 2024aac10965..b2ba38784ac6 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -59,6 +59,7 @@ Mohammad Kaif <98884589+Kaif987@users.noreply.github.com> Momtchil Momtchev Muhammad Haris Naresh Jagadeesan +Neeraj Pathak NightKnight Nithin Katta <88046362+nithinkatta@users.noreply.github.com> Nourhan Hasan <109472010+TheNourhan@users.noreply.github.com> diff --git a/lib/node_modules/@stdlib/math/base/special/atanh/src/main.c b/lib/node_modules/@stdlib/math/base/special/atanh/src/main.c index 954b9f671f17..cd2e3ca6b4f9 100644 --- a/lib/node_modules/@stdlib/math/base/special/atanh/src/main.c +++ b/lib/node_modules/@stdlib/math/base/special/atanh/src/main.c @@ -78,20 +78,24 @@ static const double NEAR_ZERO = 1.0 / (1 << 28); // 2**-28 * out = stdlib_base_atanh( 0.9 ); * // returns ~1.472 */ + +static const double one = 1.0; +static const double zero = 0.0; + double stdlib_base_atanh( const double x ) { int32_t sgn; double ax; double t; - if ( stdlib_base_is_nan( x ) || x < -1.0 || x > 1.0 ) { - return 0.0 / 0.0; // NaN + if ( stdlib_base_is_nan( x ) || x < -one || x > one ) { + return zero / zero ; // NaN } - if ( x == 1.0 ) { + if ( x === one ) { return STDLIB_CONSTANT_FLOAT64_PINF; } - if ( x == -1.0 ) { + if ( x == -one ) { return STDLIB_CONSTANT_FLOAT64_NINF; } - if ( x < 0.0 ) { + if ( x < zero ) { sgn = 1; ax = -x; } else { @@ -104,9 +108,9 @@ double stdlib_base_atanh( const double x ) { } if ( ax < 0.5 ) { t = ax + ax; - t = 0.5 * stdlib_base_log1p( t + ( t * ax / ( 1 - ax ) ) ); + t = 0.5 * stdlib_base_log1p( t + ( t * ax / ( one - ax ) ) ); } else { - t = 0.5 * stdlib_base_log1p( ( ax + ax ) / ( 1 - ax ) ); + t = 0.5 * stdlib_base_log1p( ( ax + ax ) / ( one - ax ) ); } return ( sgn == 1 ) ? -t : t; }