Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/stdlib Fix infinity detection with isinf(d), not d ...
details: https://anonhg.NetBSD.org/src/rev/9d6b3fd07c90
branches: trunk
changeset: 818876:9d6b3fd07c90
user: riastradh <riastradh%NetBSD.org@localhost>
date: Fri Nov 04 19:18:53 2016 +0000
description:
Fix infinity detection with isinf(d), not d == HUGE_VAL.
Negative infinity counts as overflow too.
Simplify.
diffstat:
lib/libc/stdlib/strtod.3 | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diffs (21 lines):
diff -r 86bac85e73eb -r 9d6b3fd07c90 lib/libc/stdlib/strtod.3
--- a/lib/libc/stdlib/strtod.3 Fri Nov 04 19:18:50 2016 +0000
+++ b/lib/libc/stdlib/strtod.3 Fri Nov 04 19:18:53 2016 +0000
@@ -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 @@
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
Home |
Main Index |
Thread Index |
Old Index