diff options
author | das <das@FreeBSD.org> | 2007-01-03 04:58:54 +0000 |
---|---|---|
committer | das <das@FreeBSD.org> | 2007-01-03 04:58:54 +0000 |
commit | 5bc737f35262327ca86ef96a7cbc6680c8eeb2ea (patch) | |
tree | 5f657cd7247cc76d6a32a0ea1f51ec09f8b25661 /contrib/gdtoa/test/Qtest.c | |
parent | 2b54587e529691da13ad420858ce167f84023ce5 (diff) | |
download | FreeBSD-src-5bc737f35262327ca86ef96a7cbc6680c8eeb2ea.zip FreeBSD-src-5bc737f35262327ca86ef96a7cbc6680c8eeb2ea.tar.gz |
Import of the latest gdtoa sources, which include fixes for minor
problems relating to NaNs and rounding.
Diffstat (limited to 'contrib/gdtoa/test/Qtest.c')
-rw-r--r-- | contrib/gdtoa/test/Qtest.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/contrib/gdtoa/test/Qtest.c b/contrib/gdtoa/test/Qtest.c index 14e5de7..f694afb 100644 --- a/contrib/gdtoa/test/Qtest.c +++ b/contrib/gdtoa/test/Qtest.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ /* Test program for g_Qfmt, strtoIQ, strtopQ, and strtorQ. * @@ -86,7 +80,7 @@ THIS SOFTWARE. int main(Void) { - char *s, *se, *se1; + char *s, *s1, *se, *se1; int i, dItry, ndig = 0, r = 1; union { long double d; ULong bits[4]; } u, v[2]; @@ -107,8 +101,17 @@ main(Void) } break; /* nan? */ case '#': - sscanf(s+1, "%lx %lx %lx %lx", &u.bits[_0], - &u.bits[_1], &u.bits[_2], &u.bits[_3]); + /* sscanf(s+1, "%lx %lx %lx %lx", &u.bits[_0], */ + /* &u.bits[_1], &u.bits[_2], &u.bits[_3]); */ + u.bits[_0] = (ULong)strtoul(s1 = s+1, &se, 16); + if (se > s1) { + u.bits[_1] = (ULong)strtoul(s1 = se, &se, 16); + if (se > s1) { + u.bits[_2] = (ULong)strtoul(s1 = se, &se, 16); + if (se > s1) + u.bits[_3] = (ULong)strtoul(s1 = se, &se, 16); + } + } printf("\nInput: %s", ibuf); printf(" --> f = #%lx %lx %lx %lx\n", u.bits[_0], u.bits[_1], u.bits[_2], u.bits[_3]); |