aboutsummaryrefslogtreecommitdiff
path: root/newlib/libc/stdlib/strtod.c
diff options
context:
space:
mode:
authorMasamichi Hosoda <trueroad@trueroad.jp>2018-08-16 09:18:50 +0900
committerCorinna Vinschen <corinna@vinschen.de>2018-08-16 13:17:44 +0200
commit6c212a8b7873703c4f98c6b68579b234918be83a (patch)
tree7e0cd5a26100af8a21664affe941dd0d75e952c8 /newlib/libc/stdlib/strtod.c
parent8f1259a6ef03edfa0f8e8b28fcaa13410b4e6b10 (diff)
downloadnewlib-6c212a8b7873703c4f98c6b68579b234918be83a.zip
newlib-6c212a8b7873703c4f98c6b68579b234918be83a.tar.gz
newlib-6c212a8b7873703c4f98c6b68579b234918be83a.tar.bz2
Fix strtod ("nan") and strtold ("nan") returns wrong negative NaN
The definition of qNaN for x86_64 and i386 was wrong. strto{d|ld} ("nan") returned wrong negative NaN instead of correct positive NaN since it used the wrong definition. On the other hand, strtof ("nan") returns correct positive NaN since it uses nanf ("") instead of the wrong definition. This commit makes strto{d|ld} ("nan") uses {nan|nanl} ("") like strtof ("nan") using. So strto{d|ld} ("nan") returns positive NaN.
Diffstat (limited to 'newlib/libc/stdlib/strtod.c')
-rw-r--r--newlib/libc/stdlib/strtod.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/newlib/libc/stdlib/strtod.c b/newlib/libc/stdlib/strtod.c
index 0cfa9e6..d70d2c2 100644
--- a/newlib/libc/stdlib/strtod.c
+++ b/newlib/libc/stdlib/strtod.c
@@ -444,10 +444,7 @@ _strtod_l (struct _reent *ptr, const char *__restrict s00, char **__restrict se,
}
else {
#endif
- dword0(rv) = NAN_WORD0;
-#ifndef _DOUBLE_IS_32BITS
- dword1(rv) = NAN_WORD1;
-#endif /*!_DOUBLE_IS_32BITS*/
+ dval(rv) = nan ("");
#ifndef No_Hex_NaN
}
#endif