Skip to content

Commit 493a9ca

Browse files
authored
chore: clean-up
Signed-off-by: Athan <[email protected]>
1 parent 33c57b3 commit 493a9ca

File tree

1 file changed

+9
-3
lines changed
  • lib/node_modules/@stdlib/math/base/special/fast/absf/lib

1 file changed

+9
-3
lines changed

lib/node_modules/@stdlib/math/base/special/fast/absf/lib/main.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@
2323
var f32 = require( '@stdlib/number/float64/base/to-float32' );
2424

2525

26+
// VARIABLES //
27+
28+
var ZERO = f32( 0.0 );
29+
30+
2631
// MAIN //
2732

2833
/**
@@ -52,10 +57,11 @@ var f32 = require( '@stdlib/number/float64/base/to-float32' );
5257
* // returns NaN
5358
*/
5459
function absf( x ) {
55-
if ( f32( x < 0.0 ) ) {
56-
return -f32( x );
60+
x = f32( x );
61+
if ( x < ZERO ) {
62+
return f32( -x );
5763
}
58-
return f32( x );
64+
return x;
5965
}
6066

6167

0 commit comments

Comments
 (0)