summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkr.angelov <kr.angelov@gmail.com>2013-09-04 07:36:39 +0000
committerkr.angelov <kr.angelov@gmail.com>2013-09-04 07:36:39 +0000
commitae87c3d272104a933d148a544c9eab15865c1758 (patch)
treec656f128c1dfacc81a68616d652d84f97305af4c
parent0aef8d1c72559e4306d50e863bafe538628a35aa (diff)
avoid using nan() in libgu for portability with Android
-rw-r--r--src/runtime/c/gu/bits.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/src/runtime/c/gu/bits.c b/src/runtime/c/gu/bits.c
index 9126b0448..398b3fdd5 100644
--- a/src/runtime/c/gu/bits.c
+++ b/src/runtime/c/gu/bits.c
@@ -35,16 +35,7 @@ gu_decode_double(uint64_t u)
double ret;
if (rawexp == 0x7ff) {
- if (mantissa == 0) {
- ret = INFINITY;
- } else {
- // At least glibc supports specifying the
- // mantissa like this.
- int len = snprintf(NULL, 0, "0x%" PRIx64, mantissa);
- char buf[len + 1];
- snprintf(buf, len + 1, "0x%" PRIx64, mantissa);
- ret = nan(buf);
- }
+ ret = (mantissa == 0) ? INFINITY : NAN;
} else {
uint64_t m = rawexp ? 1ULL << 52 | mantissa : mantissa << 1;
ret = ldexp((double) m, rawexp - 1075);