Skip to content

Commit

Permalink
refactor: use stdlib fmod and DDD_D napi function
Browse files Browse the repository at this point in the history
  • Loading branch information
gunjjoshi committed Aug 20, 2024
1 parent b345bfe commit 71ff8ee
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/node_modules/@stdlib/math/base/special/wrap/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var trunc = require( '@stdlib/math/base/special/trunc' );
var fmod = require( '@stdlib/math/base/special/fmod' );
var abs = require( '@stdlib/math/base/special/abs' );


// MAIN //
Expand Down Expand Up @@ -74,13 +75,13 @@ function wrap( v, min, max ) {
return NaN;
}
// Normalize +-0 to +0...
if ( v === 0.0 ) {
if ( abs( v ) === 0.0 ) {
v = 0.0;
}
if ( min === 0.0 ) {
if ( abs( min ) === 0.0 ) {
min = 0.0;
}
if ( max === 0.0 ) {
if ( abs( max ) === 0.0 ) {
max = 0.0;
}
// Simple case where value is already within range...
Expand Down

0 comments on commit 71ff8ee

Please sign in to comment.