File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
lib/node_modules/@stdlib/math/base/special/atanh/src Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -95,25 +95,31 @@ double stdlib_base_atanh( const double x ) {
9595 // Split `x` into high and low words:
9696 stdlib_base_float64_to_words ( x , & hx , & lx );
9797
98- ax = x ;
9998 ahx = hx & STDLIB_CONSTANT_FLOAT64_HIGH_WORD_ABS_MASK ;
10099
101100 // special cases
102- if ( ax == 1.0 ) {
101+ if ( x == 1.0 ) {
103102 return STDLIB_CONSTANT_FLOAT64_PINF ;
104103 }
105- if ( ax == -1.0 ) {
104+ if ( x == -1.0 ) {
106105 return STDLIB_CONSTANT_FLOAT64_NINF ;
107106 }
108107
108+ if ( x < 0.0 ) {
109+ hx = 1 ;
110+ ax = - x ;
111+ } else {
112+ hx = 0 ;
113+ ax = x ;
114+ }
109115 // Case: |x| < 2**-28
110116 if ( ax < NEAR_ZERO ) {
111117 return ( hx == 1 ) ? - ax : ax ;
112118 }
113119
114120 stdlib_base_float64_set_high_word ( ahx , & ax );
115121
116- if ( ahx < 0.5 ) {
122+ if ( ax < 0.5 ) {
117123 t = ax + ax ;
118124 t = 0.5 * stdlib_base_log1p ( t + ( t * ax / ( 1.0 - ax ) ) );
119125 } else {
You can’t perform that action at this time.
0 commit comments