X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/9385eb3d10ebe5eb398c52040ec3dbfba9b0cdcf..e07eda1a0324f771bb1ed20ef94f3229005ee46c:/stdlib/FreeBSD/strtod.3 diff --git a/stdlib/FreeBSD/strtod.3 b/stdlib/FreeBSD/strtod.3 index 52a0ac5..463553d 100644 --- a/stdlib/FreeBSD/strtod.3 +++ b/stdlib/FreeBSD/strtod.3 @@ -13,10 +13,6 @@ .\" 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. @@ -34,7 +30,7 @@ .\" SUCH DAMAGE. .\" .\" @(#)strtod.3 8.1 (Berkeley) 6/4/93 -.\" $FreeBSD: src/lib/libc/stdlib/strtod.3,v 1.18 2003/03/12 20:31:05 das Exp $ +.\" $FreeBSD: src/lib/libc/stdlib/strtod.3,v 1.22 2007/12/16 21:19:28 das Exp $ .\" .Dd March 2, 2003 .Dt STRTOD 3 @@ -49,11 +45,20 @@ string to floating point .Sh SYNOPSIS .In stdlib.h .Ft double -.Fn strtod "const char * restrict nptr" "char ** restrict endptr" +.Fo strtod +.Fa "const char *restrict nptr" +.Fa "char **restrict endptr" +.Fc .Ft float -.Fn strtof "const char * restrict nptr" "char ** restrict endptr" -.Ft long double -.Fn strtold "const char * restrict nptr" "char ** restrict endptr" +.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 .Sh DESCRIPTION These conversion functions convert the initial portion of the string @@ -63,19 +68,20 @@ to .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 @@ -90,8 +96,28 @@ For hexadecimal constants, the scaling is instead done by powers of 2. .Pp 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. +plus or minus sign begins with +.Dq INFINITY +or +.Dq NAN , +ignoring case, it is interpreted as an infinity or a quiet \*(Na, +respectively. +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 . ) .Pp In any of the above cases, leading white-space characters in the string (as defined by the @@ -100,6 +126,12 @@ function) are skipped. 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 , @@ -144,6 +176,8 @@ Overflow or underflow occurred. .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 @@ -152,18 +186,15 @@ The .Fn strtod function conforms to -.St -isoC-99 , -with the exception of the bug noted below. -.Sh BUGS -These routines do not recognize the C99 ``NaN(...)'' syntax. +.St -isoC-99 . .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 @@ -173,7 +204,7 @@ documentation, and that the name of Lucent or any of its entities 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 @@ -182,3 +213,4 @@ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER 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