diff options
| author | riastradh <riastradh@NetBSD.org> | 2016-11-04 19:18:53 +0000 |
|---|---|---|
| committer | riastradh <riastradh@NetBSD.org> | 2016-11-04 19:18:53 +0000 |
| commit | 0d6aeb788915e4cea1f2f7480cb954d86e95a1f4 (patch) | |
| tree | f06975a003f1b6ac865304cf510d1ba337f37bff /lib/libc/stdlib | |
| parent | 562967c89debf8681f1fc6ca83d57e303be2e504 (diff) | |
Fix infinity detection with isinf(d), not d == HUGE_VAL.
Negative infinity counts as overflow too.
Simplify.
Diffstat (limited to 'lib/libc/stdlib')
| -rw-r--r-- | lib/libc/stdlib/strtod.3 | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/stdlib/strtod.3 b/lib/libc/stdlib/strtod.3 index 4eee9a44eaf..77554889c00 100644 --- a/lib/libc/stdlib/strtod.3 +++ b/lib/libc/stdlib/strtod.3 @@ -1,4 +1,4 @@ -.\" $NetBSD: strtod.3,v 1.24 2016/11/04 19:10:04 riastradh Exp $ +.\" $NetBSD: strtod.3,v 1.25 2016/11/04 19:18:53 riastradh Exp $ .\" .\" Copyright (c) 1990, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -202,9 +202,9 @@ if (s[0] == '\e0' || end[0] != '\e0') errx(1, "invalid syntax"); if (errno) { assert(errno == ERANGE); - assert(d == HUGE_VAL || d == -HUGE_VAL || d == 0 || + assert(isinf(d) || d == 0 || fpclassify(d) == FP_SUBNORMAL); - warnx("%s", d == HUGE_VAL ? "overflow" : "underflow"); + warnx("%s", isinf(d) ? "overflow" : "underflow"); } /* d is the best floating-point approximation to the number in s */ .Ed |
