Skip to content

Commit b420bb7

Browse files
committed
Enable full fmod implementation
esp8266/Arduino#612
1 parent ae10be3 commit b420bb7

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

newlib/libm/math/ef_fmod.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
* Developed at SunPro, a Sun Microsystems, Inc. business.
1010
* Permission to use, copy, modify, and distribute this
11-
* software is freely granted, provided that this notice
11+
* software is freely granted, provided that this notice
1212
* is preserved.
1313
* ====================================================
1414
*/
@@ -18,7 +18,7 @@
1818
/* __ieee754_remainderf is provided by libgcc and presumably is faster
1919
then original implementation */
2020

21-
#if 1
21+
#if 0
2222

2323
extern float __ieee754_remainderf(float x, float y);
2424

@@ -55,7 +55,7 @@ extern float __ieee754_remainderf(float x, float y);
5555

5656
/* original version */
5757

58-
/*
58+
/*
5959
* __ieee754_fmodf(x,y)
6060
* Return x mod y in exact arithmetic
6161
* Method: shift and subtract
@@ -104,13 +104,13 @@ static float one = 1.0, Zero[] = {0.0, -0.0,};
104104
} else iy = (hy>>23)-127;
105105

106106
/* set up {hx,lx}, {hy,ly} and align y to x */
107-
if(ix >= -126)
107+
if(ix >= -126)
108108
hx = 0x00800000|(0x007fffff&hx);
109109
else { /* subnormal x, shift x to normal */
110110
n = -126-ix;
111111
hx = hx<<n;
112112
}
113-
if(iy >= -126)
113+
if(iy >= -126)
114114
hy = 0x00800000|(0x007fffff&hy);
115115
else { /* subnormal y, shift y to normal */
116116
n = -126-iy;
@@ -133,7 +133,7 @@ static float one = 1.0, Zero[] = {0.0, -0.0,};
133133

134134
/* convert back to floating value and restore the sign */
135135
if(hx==0) /* return sign(x)*0 */
136-
return Zero[(__uint32_t)sx>>31];
136+
return Zero[(__uint32_t)sx>>31];
137137
while(hx<0x00800000) { /* normalize x */
138138
hx = hx+hx;
139139
iy -= 1;
@@ -153,4 +153,3 @@ static float one = 1.0, Zero[] = {0.0, -0.0,};
153153
}
154154

155155
#endif
156-

0 commit comments

Comments
 (0)