diff options
author | joseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2007-02-23 21:23:52 +0000 |
---|---|---|
committer | joseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2007-02-23 21:23:52 +0000 |
commit | 1ff670b6372433a5e559677695009e21a0842535 (patch) | |
tree | 5138feddedbd62568e75efe34ba21276d4a717f1 | |
parent | e01a6e8c9270bef4ec96bc47a2a028fda900f201 (diff) |
Backport from mainline.
2006-01-07 Ulrich Drepper <drepper@redhat.com>
* stdio-common/tstdiomisc.c (F): Use NAN to get NaN value.
git-svn-id: svn://svn.eglibc.org/branches/eglibc-2_3@1557 7b3dc134-2b1b-0410-93df-9e9f96275f8d
-rw-r--r-- | libc/ChangeLog.eglibc | 6 | ||||
-rw-r--r-- | libc/stdio-common/tstdiomisc.c | 12 |
2 files changed, 13 insertions, 5 deletions
diff --git a/libc/ChangeLog.eglibc b/libc/ChangeLog.eglibc index 8e49e4917..33c4489b3 100644 --- a/libc/ChangeLog.eglibc +++ b/libc/ChangeLog.eglibc @@ -1,3 +1,9 @@ +2007-02-23 Joseph Myers <joseph@codesourcery.com> + + Backport from mainline. + 2006-01-07 Ulrich Drepper <drepper@redhat.com> + * stdio-common/tstdiomisc.c (F): Use NAN to get NaN value. + 2006-11-08 Joseph Myers <joseph@codesourcery.com> * sysdeps/arm/eabi/bits/predefs.h (__STDC_IEC_559__, diff --git a/libc/stdio-common/tstdiomisc.c b/libc/stdio-common/tstdiomisc.c index 452a21f9c..db038fa2b 100644 --- a/libc/stdio-common/tstdiomisc.c +++ b/libc/stdio-common/tstdiomisc.c @@ -46,6 +46,9 @@ t2 (void) return result; } +volatile double nanval; + + static int F (void) { @@ -53,8 +56,9 @@ F (void) wchar_t wbuf[10]; int result; - snprintf (buf, sizeof buf, "%f %F", DBL_MAX * DBL_MAX - DBL_MAX * DBL_MAX, - DBL_MAX * DBL_MAX - DBL_MAX * DBL_MAX); + nanval = NAN; + + snprintf (buf, sizeof buf, "%f %F", nanval, nanval); result = strcmp (buf, "nan NAN") != 0; printf ("expected \"nan NAN\", got \"%s\"\n", buf); @@ -62,9 +66,7 @@ F (void) result |= strcmp (buf, "inf INF") != 0; printf ("expected \"inf INF\", got \"%s\"\n", buf); - swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]), L"%f %F", - DBL_MAX * DBL_MAX - DBL_MAX * DBL_MAX, - DBL_MAX * DBL_MAX - DBL_MAX * DBL_MAX); + swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]), L"%f %F", nanval, nanval); result |= wcscmp (wbuf, L"nan NAN") != 0; printf ("expected L\"nan NAN\", got L\"%S\"\n", wbuf); |