mirror of
https://github.com/fluencelabs/musl
synced 2025-07-01 23:52:02 +00:00
don't try to create non-standard denormalization signal
Underflow exception is only raised when the result is invalid, but fmod is always exact. x87 has a denormalization exception, but that's nonstandard. And the superflous *1.0 will be optimized away by any compiler that does not honor signaling nans.
This commit is contained in:
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
#include "libm.h"
|
#include "libm.h"
|
||||||
|
|
||||||
static const double one = 1.0, Zero[] = {0.0, -0.0,};
|
static const double Zero[] = {0.0, -0.0,};
|
||||||
|
|
||||||
double fmod(double x, double y)
|
double fmod(double x, double y)
|
||||||
{
|
{
|
||||||
@ -140,7 +140,6 @@ double fmod(double x, double y)
|
|||||||
lx = hx>>(n-32); hx = sx;
|
lx = hx>>(n-32); hx = sx;
|
||||||
}
|
}
|
||||||
INSERT_WORDS(x, hx|sx, lx);
|
INSERT_WORDS(x, hx|sx, lx);
|
||||||
x *= one; /* create necessary signal */
|
|
||||||
}
|
}
|
||||||
return x; /* exact output */
|
return x; /* exact output */
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#include "libm.h"
|
#include "libm.h"
|
||||||
|
|
||||||
static const float one = 1.0, Zero[] = {0.0, -0.0,};
|
static const float Zero[] = {0.0, -0.0,};
|
||||||
|
|
||||||
float fmodf(float x, float y)
|
float fmodf(float x, float y)
|
||||||
{
|
{
|
||||||
@ -99,7 +99,6 @@ float fmodf(float x, float y)
|
|||||||
n = -126 - iy;
|
n = -126 - iy;
|
||||||
hx >>= n;
|
hx >>= n;
|
||||||
SET_FLOAT_WORD(x, hx|sx);
|
SET_FLOAT_WORD(x, hx|sx);
|
||||||
x *= one; /* create necessary signal */
|
|
||||||
}
|
}
|
||||||
return x; /* exact output */
|
return x; /* exact output */
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ typedef uint32_t manh_t;
|
|||||||
|
|
||||||
#define MANL_SHIFT (LDBL_MANL_SIZE - 1)
|
#define MANL_SHIFT (LDBL_MANL_SIZE - 1)
|
||||||
|
|
||||||
static const long double one = 1.0, Zero[] = {0.0, -0.0,};
|
static const long double Zero[] = {0.0, -0.0,};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* fmodl(x,y)
|
* fmodl(x,y)
|
||||||
@ -153,7 +153,6 @@ long double fmodl(long double x, long double y)
|
|||||||
} else {
|
} else {
|
||||||
ux.bits.exp = iy + BIAS;
|
ux.bits.exp = iy + BIAS;
|
||||||
}
|
}
|
||||||
x = ux.e * one; /* create necessary signal */
|
return ux.e; /* exact output */
|
||||||
return x; /* exact output */
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user