Manual Reference Pages - STRTOD (3)
strtod, strtof, strtold
string to floating point
strtod const char * restrict nptr char ** restrict endptr
strtof const char * restrict nptr char ** restrict endptr
strtold const char * restrict nptr char ** restrict endptr
functions convert the initial portion of the string
pointed to by
.Vt double ,
.Vt float ,
.Vt long double
The expected form of the string is an optional plus (+) or minus
sign (-) followed by either:
- a decimal significand consisting of a sequence of decimal digits
optionally containing a decimal-point character, or
- a hexadecimal significand consisting of a 0X or 0x followed
by a sequence of hexadecimal digits optionally containing a
In both cases, the significand may be optionally followed by an
An exponent consists of an E or e (for decimal
constants) or a P or p (for hexadecimal constants),
followed by an optional plus or minus sign, followed by a
sequence of decimal digits.
For decimal constants, the exponent indicates the power of 10 by
which the significand should be scaled.
For hexadecimal constants, the scaling is instead done by powers
Alternatively, if the portion of the string following the optional
plus or minus sign begins with
ignoring case, it is interpreted as an infinity or a quiet NaN,
"Xo NAN( s) Xc",
is an alphanumeric string, produces the same value as the call
.Fc . )
In any of the above cases, leading white-space characters in the
string (as defined by the
function) are skipped.
The decimal point
character is defined in the programs locale (category
functions return the converted value, if any.
a pointer to the character after the last character used
in the conversion is stored in the location referenced by
If no conversion is performed, zero is returned and the value of
is stored in the location referenced by
If the correct value would cause overflow, plus or minus
is returned (according to the sign and type of the return value), and
is stored in
If the correct value would cause underflow, zero is
is stored in
Overflow or underflow occurred.
The author of this software is
.An David M. Gay .
Copyright (c) 1998 by Lucent Technologies
All Rights Reserved
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
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
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
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
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
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
Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.