Merge pull request #124 from NuxiNL/cloudabi-fixes

Upstream local modifications to openlibm.
This commit is contained in:
Viral B. Shah 2016-02-27 10:29:48 -08:00
commit 1bba495716
6 changed files with 9 additions and 9 deletions

View file

@ -39,7 +39,7 @@ nanl(const char *s)
uint32_t bits[4]; uint32_t bits[4];
} u; } u;
_scan_nan(u.bits, 4, s); __scan_nan(u.bits, 4, s);
u.ieee.bits.exp = 0x7fff; u.ieee.bits.exp = 0x7fff;
u.ieee.bits.manh |= 1ULL << 47; /* make it a quiet NaN */ u.ieee.bits.manh |= 1ULL << 47; /* make it a quiet NaN */
return (u.ieee.e); return (u.ieee.e);

View file

@ -38,7 +38,7 @@ nanl(const char *s)
uint32_t bits[3]; uint32_t bits[3];
} u; } u;
_scan_nan(u.bits, 3, s); __scan_nan(u.bits, 3, s);
u.ieee.bits.exp = 0x7fff; u.ieee.bits.exp = 0x7fff;
u.ieee.bits.manh |= 0xc0000000; /* make it a quiet NaN */ u.ieee.bits.manh |= 0xc0000000; /* make it a quiet NaN */
return (u.ieee.e); return (u.ieee.e);

View file

@ -229,7 +229,7 @@ do { \
/* /*
* Common routine to process the arguments to nan(), nanf(), and nanl(). * Common routine to process the arguments to nan(), nanf(), and nanl().
*/ */
void _scan_nan(u_int32_t *__words, int __num_words, const char *__s); void __scan_nan(u_int32_t *__words, int __num_words, const char *__s);
#ifdef __GNUCLIKE_ASM #ifdef __GNUCLIKE_ASM

View file

@ -205,7 +205,7 @@ do { \
/* /*
* Common routine to process the arguments to nan(), nanf(), and nanl(). * Common routine to process the arguments to nan(), nanf(), and nanl().
*/ */
void _scan_nan(uint32_t *__words, int __num_words, const char *__s); void __scan_nan(uint32_t *__words, int __num_words, const char *__s);
/* /*
* Functions internal to the math package, yet not static. * Functions internal to the math package, yet not static.

View file

@ -375,14 +375,14 @@ exp2(double x)
/* Compute r = exp2(y) = exp2t[i0] * p(z - eps[i]). */ /* Compute r = exp2(y) = exp2t[i0] * p(z - eps[i]). */
t = tbl[i0]; /* exp2t[i0] */ t = tbl[i0]; /* exp2t[i0] */
z -= tbl[i0 + 1]; /* eps[i0] */ z -= tbl[i0 + 1]; /* eps[i0] */
if (k >= -1021 << 20) if (k >= -(1021 << 20))
INSERT_WORDS(twopk, 0x3ff00000 + k, 0); INSERT_WORDS(twopk, 0x3ff00000 + k, 0);
else else
INSERT_WORDS(twopkp1000, 0x3ff00000 + k + (1000 << 20), 0); INSERT_WORDS(twopkp1000, 0x3ff00000 + k + (1000 << 20), 0);
r = t + t * z * (P1 + z * (P2 + z * (P3 + z * (P4 + z * P5)))); r = t + t * z * (P1 + z * (P2 + z * (P3 + z * (P4 + z * P5))));
/* Scale by 2**(k>>20). */ /* Scale by 2**(k>>20). */
if(k >= -1021 << 20) { if(k >= -(1021 << 20)) {
if (k == 1024 << 20) if (k == 1024 << 20)
return (r * 2.0 * 0x1p1023); return (r * 2.0 * 0x1p1023);
return (r * twopk); return (r * twopk);

View file

@ -62,7 +62,7 @@ static __inline int digittoint(int c) {
* impossible to use nan(3) portably anyway, so this seems good enough. * impossible to use nan(3) portably anyway, so this seems good enough.
*/ */
DLLEXPORT void DLLEXPORT void
_scan_nan(u_int32_t *words, int num_words, const char *s) __scan_nan(u_int32_t *words, int num_words, const char *s)
{ {
int si; /* index into s */ int si; /* index into s */
int bitpos; /* index into words (in bits) */ int bitpos; /* index into words (in bits) */
@ -97,7 +97,7 @@ nan(const char *s)
u_int32_t bits[2]; u_int32_t bits[2];
} u; } u;
_scan_nan(u.bits, 2, s); __scan_nan(u.bits, 2, s);
#if _BYTE_ORDER == _LITTLE_ENDIAN #if _BYTE_ORDER == _LITTLE_ENDIAN
u.bits[1] |= 0x7ff80000; u.bits[1] |= 0x7ff80000;
#else #else
@ -114,7 +114,7 @@ nanf(const char *s)
u_int32_t bits[1]; u_int32_t bits[1];
} u; } u;
_scan_nan(u.bits, 1, s); __scan_nan(u.bits, 1, s);
u.bits[0] |= 0x7fc00000; u.bits[0] |= 0x7fc00000;
return (u.f); return (u.f);
} }