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 description of ERANGE cases again.



details:   https://anonhg.NetBSD.org/src/rev/c54c59233bb7
branches:  trunk
changeset: 818873:c54c59233bb7
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Fri Nov 04 18:46:15 2016 +0000

description:
Fix description of ERANGE cases again.

Do use the technical terms `overflow' and `underflow', because strtod
sets ERANGE precisely to indicate either of these two conditions, and
they are the right keywords that one might be looking for.

Note that strtod may set ERANGE even if it returns noninfinity and
nonzero -- specifically, if the result is subnormal.  This part was
wrong before I `fixed' it and remained wrong after I `fixed' it
earlier this year.

diffstat:

 lib/libc/stdlib/strtod.3 |  16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diffs (44 lines):

diff -r 1bc2577e58f4 -r c54c59233bb7 lib/libc/stdlib/strtod.3
--- a/lib/libc/stdlib/strtod.3  Fri Nov 04 18:14:04 2016 +0000
+++ b/lib/libc/stdlib/strtod.3  Fri Nov 04 18:46:15 2016 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: strtod.3,v 1.22 2016/03/17 09:43:38 wiz Exp $
+.\"    $NetBSD: strtod.3,v 1.23 2016/11/04 18:46:15 riastradh Exp $
 .\"
 .\" Copyright (c) 1990, 1991, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -33,7 +33,7 @@
 .\"
 .\"     from: @(#)strtod.3     8.1 (Berkeley) 6/4/93
 .\"
-.Dd March 17, 2016
+.Dd November 4, 2016
 .Dt STRTOD 3
 .Os
 .Sh NAME
@@ -151,8 +151,9 @@
 is stored in the location referenced by
 .Fa endptr .
 .Pp
-If the correct value is too large in magnitude to be represented, plus
-or minus
+If the correct value is too large in magnitude to be represented
+.Pq Sq overflow ,
+plus or minus
 .Dv HUGE_VAL ,
 .Dv HUGE_VALF ,
 or
@@ -161,8 +162,11 @@
 .Dv ERANGE
 is stored in
 .Va errno .
-If the correct value is nonzero but too small in magnitude to be
-represented as nonzero, zero is returned and
+.Pp
+If the correct value is too small in magnitude to be represented
+normally with full precision
+.Pq Sq underflow ,
+the closest subnormal value, or zero, is returned, and
 .Dv ERANGE
 is stored in
 .Va errno .



Home | Main Index | Thread Index | Old Index