Skip to content

Commit 984f378

Browse files
authored
Update main.c
Signed-off-by: Gunj Joshi <gunjjoshi8372@gmail.com>
1 parent 6818629 commit 984f378

File tree

1 file changed

+7
-6
lines changed
  • lib/node_modules/@stdlib/math/base/special/wrap/src

1 file changed

+7
-6
lines changed

lib/node_modules/@stdlib/math/base/special/wrap/src/main.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@
1919
#include "stdlib/math/base/special/wrap.h"
2020
#include "stdlib/math/base/assert/is_nan.h"
2121
#include "stdlib/math/base/special/trunc.h"
22-
#include "stdlib/math/base/special/fmod.h"
23-
#include "stdlib/math/base/special/abs.h"
22+
#include <math.h>
23+
24+
// TODO: remove <math.h> header and fmod once we have stdlib equivalent
2425

2526
/**
2627
* Wraps a value on the half-open interval [min,max).
@@ -48,13 +49,13 @@ double stdlib_base_wrap( const double v, const double min, const double max ) {
4849
vc = v;
4950

5051
// Normalize +-0 to +0...
51-
if ( stdlib_base_abs( vc ) == 0.0 ) {
52+
if ( vc == 0.0 ) {
5253
vc = 0.0;
5354
}
54-
if ( stdlib_base_abs( minc ) == 0.0 ) {
55+
if ( minc == 0.0 ) {
5556
minc = 0.0;
5657
}
57-
if ( stdlib_base_abs( maxc ) == 0.0 ) {
58+
if ( maxc == 0.0 ) {
5859
maxc = 0.0;
5960
}
6061
// Simple case where value is already within range...
@@ -66,5 +67,5 @@ double stdlib_base_wrap( const double v, const double min, const double max ) {
6667
if ( vc < minc ) {
6768
vc += delta * ( stdlib_base_trunc( ( minc - vc ) / delta ) + 1.0 );
6869
}
69-
return minc + ( stdlib_base_fmod( vc - minc, delta ) );
70+
return minc + ( fmod( vc - minc, delta ) );
7071
}

0 commit comments

Comments
 (0)