From d2ea52e0ecb3691bc326d0a401976f823dd0faaa Mon Sep 17 00:00:00 2001 From: "kr.angelov" Date: Wed, 4 Sep 2013 07:36:39 +0000 Subject: [PATCH] avoid using nan() in libgu for portability with Android --- src/runtime/c/gu/bits.c | 11 +---------- 1 file changed, 1 insertion(+), 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);