Skip to content

Commit 5208ebc

Browse files
chore: add f64 to f32 conversions
Signed-off-by: Nakul Krishnakumar <nakulkrishnakumar86@gmail.com>
1 parent 7e102fc commit 5208ebc

File tree

1 file changed

+6
-2
lines changed
  • lib/node_modules/@stdlib/math/base/special/acoshf/lib

1 file changed

+6
-2
lines changed

lib/node_modules/@stdlib/math/base/special/acoshf/lib/main.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ var HUGE = 1 << 28; // 2**28
9595
*/
9696
function acoshf( x ) {
9797
var t;
98+
var s;
99+
x = f32( x );
98100
if ( isnanf( x ) || x < 1.0 ) {
99101
return NaN;
100102
}
@@ -105,11 +107,13 @@ function acoshf( x ) {
105107
return f32( lnf( x ) + FLOAT32_LN2 );
106108
}
107109
if ( x > 2.0 ) {
108-
return lnf( f32( 2.0*x ) - f32( 1.0 / f32( x + sqrtf( f32( x*x ) - 1.0 ) ) ) );
110+
t = f32( x*x );
111+
s = f32( t - 1.0 );
112+
return lnf( f32( f32( 2.0*x ) - f32( 1.0 / f32( x + sqrtf( s ) ) ) ) );
109113
}
110114
// Case: 2 >= x > 1
111115
t = f32( x - 1.0 );
112-
return log1pf( t + sqrtf( f32( 2.0*t ) + f32( t*t ) ) );
116+
return log1pf( f32( t + sqrtf( f32( f32( 2.0*t ) + f32( t*t ) ) ) ) );
113117
}
114118

115119

0 commit comments

Comments
 (0)