[patch] strtod.3: Fix return value for underflow

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In C89 strtod returns zero on underflow, but since C99 it can return
non-zero. This means the strtod.3 page contradicts all recent C and
POSIX standards. Both C and POSIX say "smallest normalized positive
number", but for consistency with HUGE_VAL, HUGE_VALF and HUGE_VALL
this patch uses the constants for those numbers.

Also slightly improve the presentation of return values for overflow.

diff --git a/man3/strtod.3 b/man3/strtod.3
index a271498d5..56ddb5f27 100644
--- a/man3/strtod.3
+++ b/man3/strtod.3
@@ -138,15 +138,23 @@ is stored in the location referenced by
 .IR endptr .
 .PP
 If the correct value would cause overflow, plus or minus
-.B HUGE_VAL
-.RB ( HUGE_VALF ,
-.BR HUGE_VALL )
-is returned (according to the sign of the value), and
+.BR HUGE_VAL ,
+.BR HUGE_VALF ,
+or
+.B HUGE_VALL
+is returned (according to the return type and sign of the value),
+and
 .B ERANGE
 is stored in
 .IR errno .
-If the correct value would cause underflow, zero is
-returned and
+.PP
+If the correct value would cause underflow,
+a value with magnitude no larger than
+.BR DBL_MIN ,
+.BR FLT_MIN ,
+or
+.B LDBL_MIN
+is returned and
 .B ERANGE
 is stored in
 .IR errno .




[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux