Skip to content

Commit 7e102fc

Browse files
chore: add f32 conversions for computation statements
Signed-off-by: Nakul Krishnakumar <nakulkrishnakumar86@gmail.com>
1 parent 9b2442b commit 7e102fc

File tree

1 file changed

+5
-4
lines changed
  • lib/node_modules/@stdlib/math/base/special/acoshf/lib

1 file changed

+5
-4
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ var log1pf = require( '@stdlib/math/base/special/log1pf' );
3939
var sqrtf = require( '@stdlib/math/base/special/sqrtf' );
4040
var FLOAT32_LN2 = require( '@stdlib/constants/float32/ln-two' );
4141
var lnf = require( '@stdlib/math/base/special/lnf' );
42+
var f32 = require( '@stdlib/number/float64/base/to-float32' );
4243

4344

4445
// VARIABLES //
@@ -101,14 +102,14 @@ function acoshf( x ) {
101102
return 0.0;
102103
}
103104
if ( x >= HUGE ) {
104-
return lnf( x ) + FLOAT32_LN2;
105+
return f32( lnf( x ) + FLOAT32_LN2 );
105106
}
106107
if ( x > 2.0 ) {
107-
return lnf( (2.0*x) - ( 1.0 / ( x + sqrtf( (x*x) - 1.0 ) ) ) );
108+
return lnf( f32( 2.0*x ) - f32( 1.0 / f32( x + sqrtf( f32( x*x ) - 1.0 ) ) ) );
108109
}
109110
// Case: 2 >= x > 1
110-
t = x - 1.0;
111-
return log1pf( t + sqrtf( (2.0*t) + (t*t) ) );
111+
t = f32( x - 1.0 );
112+
return log1pf( t + sqrtf( f32( 2.0*t ) + f32( t*t ) ) );
112113
}
113114

114115

0 commit comments

Comments
 (0)