1 .\" Copyright (c) 1990, 1991, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" This code is derived from software contributed to Berkeley by
5 .\" the American National Standards Committee X3, on Information
6 .\" Processing Systems.
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\" notice, this list of conditions and the following disclaimer.
13 .\" 2. Redistributions in binary form must reproduce the above copyright
14 .\" notice, this list of conditions and the following disclaimer in the
15 .\" documentation and/or other materials provided with the distribution.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" @(#)strtod.3 8.1 (Berkeley) 6/4/93
33 .\" $FreeBSD: src/lib/libc/stdlib/strtod.3,v 1.22 2007/12/16 21:19:28 das Exp $
39 .Nm strtod , strtof , strtold
42 string to floating point
49 .Fa "const char *restrict nptr"
50 .Fa "char **restrict endptr"
54 .Fa "const char *restrict nptr"
55 .Fa "char **restrict endptr"
59 .Fa "const char *restrict nptr"
60 .Fa "char **restrict endptr"
64 functions convert the initial portion of the string
72 representation, respectively.
74 The expected form of the string
75 is an optional plus (``+'') or minus (``\-'') sign,
79 a decimal significand, consisting of a sequence of decimal digits
80 (optionally containing a decimal-point character) or
82 a hexadecimal significand, consisting of a ``0X'' or ``0x'' followed
83 by a sequence of hexadecimal digits
84 (optionally containing a decimal-point character).
87 In both cases, the significand may be optionally followed by an
89 An exponent consists of an ``E'' or ``e'' (for decimal
90 constants) or a ``P'' or ``p'' (for hexadecimal constants),
91 followed by an optional plus or minus sign, followed by a
92 sequence of decimal digits.
93 For decimal constants, the exponent indicates the power of 10 by
94 which the significand should be scaled.
95 For hexadecimal constants, the scaling is instead done by powers
98 Alternatively, if the portion of the string following the optional
99 plus or minus sign begins with
103 ignoring case, it is interpreted as an infinity or a quiet \*(Na,
106 .Dq Xo Pf NAN( Ar "s" ) Xc ,
109 is an alphanumeric string, produces the same value as the call
122 In any of the above cases, leading white-space characters in the
123 string (as defined by the
125 function) are skipped.
127 character is defined in the program's locale (category
130 Extended locale versions of these functions are documented in
134 for more information.
141 functions return the converted value, if any.
147 a pointer to the character after the last character used
148 in the conversion is stored in the location referenced by
151 If no conversion is performed, zero is returned and the value of
153 is stored in the location referenced by
156 If the correct value would cause overflow, plus or minus
161 is returned (according to the sign and type of the return value), and
165 If the correct value would cause underflow, zero is
173 Overflow or underflow occurred.
191 The author of this software is
195 Copyright (c) 1998 by Lucent Technologies
198 Permission to use, copy, modify, and distribute this software and
199 its documentation for any purpose and without fee is hereby
200 granted, provided that the above copyright notice appear in all
201 copies and that both that the copyright notice and this
202 permission notice and warranty disclaimer appear in supporting
203 documentation, and that the name of Lucent or any of its entities
204 not be used in advertising or publicity pertaining to
205 distribution of the software without specific, written prior
208 LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
209 INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
210 IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
211 SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
212 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
213 IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
214 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF