Loading...
--- Libc/Libc-1725.40.4/stdlib/FreeBSD/strtod.3
+++ Libc/Libc-320/stdlib/FreeBSD/strtod.3
@@ -13,6 +13,10 @@
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
@@ -30,9 +34,9 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)strtod.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdlib/strtod.3,v 1.22 2007/12/16 21:19:28 das Exp $
+.\" $FreeBSD: src/lib/libc/stdlib/strtod.3,v 1.18 2003/03/12 20:31:05 das Exp $
.\"
-.Dd July 2, 2021
+.Dd March 2, 2003
.Dt STRTOD 3
.Os
.Sh NAME
@@ -45,20 +49,11 @@
.Sh SYNOPSIS
.In stdlib.h
.Ft double
-.Fo strtod
-.Fa "const char *restrict nptr"
-.Fa "char **restrict endptr"
-.Fc
+.Fn strtod "const char * restrict nptr" "char ** restrict endptr"
.Ft float
-.Fo strtof
-.Fa "const char *restrict nptr"
-.Fa "char **restrict endptr"
-.Fc
-.Ft "long double"
-.Fo strtold
-.Fa "const char *restrict nptr"
-.Fa "char **restrict endptr"
-.Fc
+.Fn strtof "const char * restrict nptr" "char ** restrict endptr"
+.Ft long double
+.Fn strtold "const char * restrict nptr" "char ** restrict endptr"
.Sh DESCRIPTION
These conversion
functions convert the initial portion of the string
@@ -68,20 +63,19 @@
.Vt double ,
.Vt float ,
and
-.Vt "long double"
+.Vt long double
representation, respectively.
.Pp
-The expected form of the string
-is an optional plus (``+'') or minus (``\-'') sign,
-followed by either:
+The expected form of the string is an optional plus (``+'') or minus
+sign (``\-'') followed by either:
.Bl -bullet
.It
-a decimal significand, consisting of a sequence of decimal digits
-(optionally containing a decimal-point character) or
+a decimal significand consisting of a sequence of decimal digits
+optionally containing a decimal-point character, or
.It
-a hexadecimal significand, consisting of a ``0X'' or ``0x'' followed
-by a sequence of hexadecimal digits
-(optionally containing a decimal-point character).
+a hexadecimal significand consisting of a ``0X'' or ``0x'' followed
+by a sequence of hexadecimal digits optionally containing a
+decimal-point character.
.El
.Pp
In both cases, the significand may be optionally followed by an
@@ -95,33 +89,9 @@
For hexadecimal constants, the scaling is instead done by powers
of 2.
.Pp
-If the portion of the string following the optional
-plus or minus sign begins with
-.Dq INFINITY
-or
-.Dq INF ,
-ignoring case, it is interpreted as an infinity.
-.Pp
-If the portion of the string following the optional
-plus or minus sign begins with
-.Dq NAN ,
-ignoring case, it is interpreted as a quiet \*(Na.
-The syntax
-.Dq Xo Pf NAN( Ar "s" ) Xc ,
-where
-.Ar s
-is an alphanumeric string, produces the same value as the call
-.Fo nan
-.Qq Ar s Ns
-.Fc
-(respectively,
-.Fo nanf
-.Qq Ar s Ns
-.Fc
-and
-.Fo nanl
-.Qq Ar s Ns
-.Fc . )
+Alternatively, if the portion of the string following the optional
+plus or minus sign begins with ``INFINITY'' or ``NAN'', ignoring
+case, it is interpreted as an infinity or a quiet NaN, respectively.
.Pp
In any of the above cases, leading white-space characters in the
string (as defined by the
@@ -130,28 +100,13 @@
The decimal point
character is defined in the program's locale (category
.Dv LC_NUMERIC ) .
-.Pp
-Extended locale versions of these functions are documented in
-.Xr strtod_l 3 .
-See
-.Xr xlocale 3
-for more information.
.Sh RETURN VALUES
The
.Fn strtod ,
.Fn strtof ,
and
.Fn strtold
-functions return the converted value, if any, rounded to the nearest
-representable value of the corresponding type according to the rounding
-mode currently in effect.
-See
-.Xr fegetround 3
-for more information on rounding modes.
-If flush-to-zero behavior is enabled in the current floating-point
-environment, the behavior is identical except that any subnormal
-values that would be returned will instead be returned as the
-correspondingly-signed zero.
+functions return the converted value, if any.
.Pp
If
.Fa endptr
@@ -166,26 +121,20 @@
is stored in the location referenced by
.Fa endptr .
.Pp
-The input is converted by first rounding the value to the precision of
-the target type but allowing an unbounded exponent range.
-If the resulting exponent is too large for the target
-type, overflow is deemed to have occurred.
-Overflow is signalled by returning
+If the correct value would cause overflow, plus or minus
.Dv HUGE_VAL ,
.Dv HUGE_VALF ,
or
.Dv HUGE_VALL
-(according to the sign of the input and type of the return value), and storing
-.Er ERANGE
-in
-.Va errno .
-.Pp
-If the input string is not an explicit representation of zero and the
-correctly-rounded result is a subnormal or zero value, then
+is returned (according to the sign and type of the return value), and
.Er ERANGE
is stored in
-.Va errno
-to indicate underflow has occurred.
+.Va errno .
+If the correct value would cause underflow, zero is
+returned and
+.Er ERANGE
+is stored in
+.Va errno .
.Sh ERRORS
.Bl -tag -width Er
.It Bq Er ERANGE
@@ -195,8 +144,6 @@
.Xr atof 3 ,
.Xr atoi 3 ,
.Xr atol 3 ,
-.Xr nan 3 ,
-.Xr strtod_l 3 ,
.Xr strtol 3 ,
.Xr strtoul 3 ,
.Xr wcstod 3
@@ -205,12 +152,18 @@
.Fn strtod
function
conforms to
-.St -isoC-99 .
+.St -isoC-99 ,
+with the exception of the bug noted below.
+.Sh BUGS
+These routines do not recognize the C99 ``NaN(...)'' syntax.
+.Sh AUTHORS
+The author of this software is
+.An David M. Gay .
.Pp
-.Bd -literal
Copyright (c) 1998 by Lucent Technologies
+.br
All Rights Reserved
-
+.Pp
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
@@ -220,7 +173,7 @@
not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior
permission.
-
+.Pp
LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
@@ -229,4 +182,3 @@
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
-.Ed