Module Name: src Committed By: riastradh Date: Thu Mar 17 03:26:15 UTC 2016
Modified Files: src/lib/libc/stdlib: strtod.3 Log Message: strtod yields ERANGE for below-subnormal magnitudes, not underflow. For a floating-point computation, in the language of IEEE 754, `underflow' means the output was rounded and is too small to be represented *normally*. There are many nonzero floating-point numbers to which the exact output may have been rounded -- namely subnormals. The condition under which strtod returns ERANGE for small magnitudes is when the magnitude of the exact result is so small it is rounded to zero, not even to a subnormal. While here, use parallel language about large magnitudes instead of the (albeit correct) word `overflow', to avoid temptation to treat `underflow' as the opposite notion with zero instead of infinity. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 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.20 src/lib/libc/stdlib/strtod.3:1.21 --- src/lib/libc/stdlib/strtod.3:1.20 Wed Oct 24 13:42:10 2007 +++ src/lib/libc/stdlib/strtod.3 Thu Mar 17 03:26:15 2016 @@ -1,4 +1,4 @@ -.\" $NetBSD: strtod.3,v 1.20 2007/10/24 13:42:10 reed Exp $ +.\" $NetBSD: strtod.3,v 1.21 2016/03/17 03:26:15 riastradh Exp $ .\" .\" Copyright (c) 1990, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -151,7 +151,8 @@ If no conversion is performed, zero is r is stored in the location referenced by .Fa endptr . .Pp -If the correct value would cause overflow, plus or minus +If the correct value is too large in magnitude to be represented, plus +or minus .Dv HUGE_VAL , .Dv HUGE_VALF , or @@ -160,15 +161,15 @@ is returned (according to the return typ .Dv ERANGE is stored in .Va errno . -If the correct value would cause underflow, zero is -returned and +If the correct value is nonzero but too small in magnitude to be +represented as nonzero, zero is returned and .Dv ERANGE is stored in .Va errno . .Sh ERRORS .Bl -tag -width Er .It Bq Er ERANGE -Overflow or underflow occurred. +The value is too large or small in magnitude to be represented. .El .Sh SEE ALSO .Xr atof 3 ,