Skip to content

Commit 71ff8ee

Browse files
committed
refactor: use stdlib fmod and DDD_D napi function
1 parent b345bfe commit 71ff8ee

File tree

1 file changed

+4
-3
lines changed
  • lib/node_modules/@stdlib/math/base/special/wrap/lib

1 file changed

+4
-3
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2424
var trunc = require( '@stdlib/math/base/special/trunc' );
2525
var fmod = require( '@stdlib/math/base/special/fmod' );
26+
var abs = require( '@stdlib/math/base/special/abs' );
2627

2728

2829
// MAIN //
@@ -74,13 +75,13 @@ function wrap( v, min, max ) {
7475
return NaN;
7576
}
7677
// Normalize +-0 to +0...
77-
if ( v === 0.0 ) {
78+
if ( abs( v ) === 0.0 ) {
7879
v = 0.0;
7980
}
80-
if ( min === 0.0 ) {
81+
if ( abs( min ) === 0.0 ) {
8182
min = 0.0;
8283
}
83-
if ( max === 0.0 ) {
84+
if ( abs( max ) === 0.0 ) {
8485
max = 0.0;
8586
}
8687
// Simple case where value is already within range...

0 commit comments

Comments
 (0)