aboutsummaryrefslogtreecommitdiff
path: root/stdio-common/tstdiomisc.c
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2013-02-28 17:12:25 +0100
committerThomas Schwinge <thomas@codesourcery.com>2013-03-15 19:06:02 +0100
commit67e971f18ffc9b3ea57cbccba54d5203d1e6a988 (patch)
treef62ff6123ac01815295b6d6f6f9dba73c1c65862 /stdio-common/tstdiomisc.c
parent64487e126468f91ecdfe7ab7a0f3a82762874d5a (diff)
downloadglibc-67e971f18ffc9b3ea57cbccba54d5203d1e6a988.zip
glibc-67e971f18ffc9b3ea57cbccba54d5203d1e6a988.tar.gz
glibc-67e971f18ffc9b3ea57cbccba54d5203d1e6a988.tar.bz2
Better distinguish between NaN/qNaN/sNaN.
Diffstat (limited to 'stdio-common/tstdiomisc.c')
-rw-r--r--stdio-common/tstdiomisc.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/stdio-common/tstdiomisc.c b/stdio-common/tstdiomisc.c
index c1c6895..d24c55f 100644
--- a/stdio-common/tstdiomisc.c
+++ b/stdio-common/tstdiomisc.c
@@ -46,9 +46,9 @@ t2 (void)
return result;
}
-volatile double nanval;
+volatile double qnanval;
volatile double infval;
-volatile long double lnanval;
+volatile long double lqnanval;
volatile long double linfval;
@@ -59,16 +59,17 @@ F (void)
wchar_t wbuf[40];
int result;
- nanval = NAN;
+ qnanval = NAN;
snprintf (buf, sizeof buf, "%a %A %e %E %f %F %g %G",
- nanval, nanval, nanval, nanval, nanval, nanval, nanval, nanval);
+ qnanval, qnanval, qnanval, qnanval,
+ qnanval, qnanval, qnanval, qnanval);
result = strcmp (buf, "nan NAN nan NAN nan NAN nan NAN") != 0;
printf ("expected \"nan NAN nan NAN nan NAN nan NAN\", got \"%s\"\n", buf);
snprintf (buf, sizeof buf, "%a %A %e %E %f %F %g %G",
- -nanval, -nanval, -nanval, -nanval,
- -nanval, -nanval, -nanval, -nanval);
+ -qnanval, -qnanval, -qnanval, -qnanval,
+ -qnanval, -qnanval, -qnanval, -qnanval);
result = strcmp (buf, "-nan -NAN -nan -NAN -nan -NAN -nan -NAN") != 0;
printf ("expected \"-nan -NAN -nan -NAN -nan -NAN -nan -NAN\", got \"%s\"\n",
buf);
@@ -88,13 +89,14 @@ F (void)
buf);
swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]), L"%a %A %e %E %f %F %g %G",
- nanval, nanval, nanval, nanval, nanval, nanval, nanval, nanval);
+ qnanval, qnanval, qnanval, qnanval,
+ qnanval, qnanval, qnanval, qnanval);
result |= wcscmp (wbuf, L"nan NAN nan NAN nan NAN nan NAN") != 0;
printf ("expected L\"nan NAN nan NAN nan NAN nan NAN\", got L\"%S\"\n", wbuf);
swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]), L"%a %A %e %E %f %F %g %G",
- -nanval, -nanval, -nanval, -nanval,
- -nanval, -nanval, -nanval, -nanval);
+ -qnanval, -qnanval, -qnanval, -qnanval,
+ -qnanval, -qnanval, -qnanval, -qnanval);
result |= wcscmp (wbuf, L"-nan -NAN -nan -NAN -nan -NAN -nan -NAN") != 0;
printf ("expected L\"-nan -NAN -nan -NAN -nan -NAN -nan -NAN\", got L\"%S\"\n",
wbuf);
@@ -111,17 +113,17 @@ F (void)
printf ("expected L\"-inf -INF -inf -INF -inf -INF -inf -INF\", got L\"%S\"\n",
wbuf);
- lnanval = NAN;
+ lqnanval = NAN;
snprintf (buf, sizeof buf, "%La %LA %Le %LE %Lf %LF %Lg %LG",
- lnanval, lnanval, lnanval, lnanval,
- lnanval, lnanval, lnanval, lnanval);
+ lqnanval, lqnanval, lqnanval, lqnanval,
+ lqnanval, lqnanval, lqnanval, lqnanval);
result = strcmp (buf, "nan NAN nan NAN nan NAN nan NAN") != 0;
printf ("expected \"nan NAN nan NAN nan NAN nan NAN\", got \"%s\"\n", buf);
snprintf (buf, sizeof buf, "%La %LA %Le %LE %Lf %LF %Lg %LG",
- -lnanval, -lnanval, -lnanval, -lnanval,
- -lnanval, -lnanval, -lnanval, -lnanval);
+ -lqnanval, -lqnanval, -lqnanval, -lqnanval,
+ -lqnanval, -lqnanval, -lqnanval, -lqnanval);
result = strcmp (buf, "-nan -NAN -nan -NAN -nan -NAN -nan -NAN") != 0;
printf ("expected \"-nan -NAN -nan -NAN -nan -NAN -nan -NAN\", got \"%s\"\n",
buf);
@@ -143,15 +145,15 @@ F (void)
swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]),
L"%La %LA %Le %LE %Lf %LF %Lg %LG",
- lnanval, lnanval, lnanval, lnanval,
- lnanval, lnanval, lnanval, lnanval);
+ lqnanval, lqnanval, lqnanval, lqnanval,
+ lqnanval, lqnanval, lqnanval, lqnanval);
result |= wcscmp (wbuf, L"nan NAN nan NAN nan NAN nan NAN") != 0;
printf ("expected L\"nan NAN nan NAN nan NAN nan NAN\", got L\"%S\"\n", wbuf);
swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]),
L"%La %LA %Le %LE %Lf %LF %Lg %LG",
- -lnanval, -lnanval, -lnanval, -lnanval,
- -lnanval, -lnanval, -lnanval, -lnanval);
+ -lqnanval, -lqnanval, -lqnanval, -lqnanval,
+ -lqnanval, -lqnanval, -lqnanval, -lqnanval);
result |= wcscmp (wbuf, L"-nan -NAN -nan -NAN -nan -NAN -nan -NAN") != 0;
printf ("expected L\"-nan -NAN -nan -NAN -nan -NAN -nan -NAN\", got L\"%S\"\n",
wbuf);