projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix wide printf forms ignoring width for %lc format specifier
[musl]
/
src
/
math
/
modfl.c
diff --git
a/src/math/modfl.c
b/src/math/modfl.c
index
f736bba
..
a47b192
100644
(file)
--- a/
src/math/modfl.c
+++ b/
src/math/modfl.c
@@
-3,14
+3,17
@@
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double modfl(long double x, long double *iptr)
{
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double modfl(long double x, long double *iptr)
{
- return modf(x, (double *)iptr);
+ double d;
+ long double r;
+
+ r = modf(x, &d);
+ *iptr = d;
+ return r;
}
#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384
}
#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384
-#if LDBL_MANT_DIG == 64
-#define TOINT 0x1p63
-#elif LDBL_MANT_DIG == 113
-#define TOINT 0x1p112
-#endif
+
+static const long double toint = 1/LDBL_EPSILON;
+
long double modfl(long double x, long double *iptr)
{
union ldshape u = {x};
long double modfl(long double x, long double *iptr)
{
union ldshape u = {x};
@@
-35,7
+38,7
@@
long double modfl(long double x, long double *iptr)
/* raises spurious inexact */
absx = s ? -x : x;
/* raises spurious inexact */
absx = s ? -x : x;
- y = absx +
TOINT - TOINT
- absx;
+ y = absx +
toint - toint
- absx;
if (y == 0) {
*iptr = x;
return s ? -0.0 : 0.0;
if (y == 0) {
*iptr = x;
return s ? -0.0 : 0.0;