Module Name:    src
Committed By:   riastradh
Date:           Fri Nov  4 19:18:53 UTC 2016

Modified Files:
        src/lib/libc/stdlib: strtod.3

Log Message:
Fix infinity detection with isinf(d), not d == HUGE_VAL.

Negative infinity counts as overflow too.

Simplify.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/lib/libc/stdlib/strtod.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/stdlib/strtod.3
diff -u src/lib/libc/stdlib/strtod.3:1.24 src/lib/libc/stdlib/strtod.3:1.25
--- src/lib/libc/stdlib/strtod.3:1.24	Fri Nov  4 19:10:04 2016
+++ src/lib/libc/stdlib/strtod.3	Fri Nov  4 19:18:53 2016
@@ -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

Reply via email to