version 1 showing authors affecting page license.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
STRTOD |
|
|
2 |
!!!STRTOD |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
RETURN VALUE |
|
|
7 |
ERRORS |
|
|
8 |
CONFORMING TO |
|
|
9 |
SEE ALSO |
|
|
10 |
---- |
|
|
11 |
!!NAME |
|
|
12 |
|
|
|
13 |
|
|
|
14 |
strtod, strtof, strtold - convert ASCII string to floating point number |
|
|
15 |
!!SYNOPSIS |
|
|
16 |
|
|
|
17 |
|
|
|
18 |
__#include __ |
|
|
19 |
|
|
|
20 |
|
|
|
21 |
__double strtod(const char *__''nptr''__, char |
|
|
22 |
**__''endptr''__); |
|
|
23 |
float strtof(const char *__''nptr''__, char |
|
|
24 |
**__''endptr''__); |
|
|
25 |
long double strtold(const char *__''nptr''__, char |
|
|
26 |
**__''endptr''__);__ |
|
|
27 |
!!DESCRIPTION |
|
|
28 |
|
|
|
29 |
|
|
|
30 |
The __strtod__, __strtof__, and __strtold__ |
|
|
31 |
functions convert the initial portion of the string pointed |
|
|
32 |
to by ''nptr'' to __double__, __float__, and |
|
|
33 |
__long double__ representation, |
|
|
34 |
respectively. |
|
|
35 |
|
|
|
36 |
|
|
|
37 |
The expected form of the (initial portion of the) string is |
|
|
38 |
optional leading white space as recognized by ''is- |
|
|
39 |
space''(3), an optional plus (``+'') or minus sign (``-'') |
|
|
40 |
and then either (i) a decimal number, or (ii) a hexadecimal |
|
|
41 |
number, or (iii) an infinity, or (iv) a NAN |
|
|
42 |
(not-a-number). |
|
|
43 |
|
|
|
44 |
|
|
|
45 |
A ''decimal number'' consists of a nonempty sequence of |
|
|
46 |
decimal digits possibly containing a radix character |
|
|
47 |
(decimal point, locale dependent, usually ``.''), optionally |
|
|
48 |
followed by a decimal exponent. A decimal exponent consists |
|
|
49 |
of an ``E'' or ``e'', followed by an optional plus or minus |
|
|
50 |
sign, followed by a non-empty sequence of decimal digits, |
|
|
51 |
and indicates multiplication by a power of 10. |
|
|
52 |
|
|
|
53 |
|
|
|
54 |
A ''hexadecimal number'' consists of a ``0x'' or ``0X'' |
|
|
55 |
followed by a nonempty sequence of hexadecimal digits |
|
|
56 |
possibly containing a radix character, optionally followed |
|
|
57 |
by a binary exponent. A binary exponent consists of a ``P'' |
|
|
58 |
or ``p'', followed by an optional plus or minus sign, |
|
|
59 |
followed by a non-empty sequence of decimal digits, and |
|
|
60 |
indicates multiplication by a power of 2. At least one of |
|
|
61 |
radix character and binary exponent must be |
|
|
62 |
present. |
|
|
63 |
|
|
|
64 |
|
|
|
65 |
An ''infinity'' is either ``INF'' or ``INFINITY'', |
|
|
66 |
disregarding case. |
|
|
67 |
|
|
|
68 |
|
|
|
69 |
A ''NAN'' is ``NAN'' (disregarding case) optionally |
|
|
70 |
followed by `(', a sequence of characters, followed by ')'. |
|
|
71 |
The character string specifies in an |
|
|
72 |
implementation-dependent way the type of NAN. |
|
|
73 |
!!RETURN VALUE |
|
|
74 |
|
|
|
75 |
|
|
|
76 |
These functions return the converted value, if |
|
|
77 |
any. |
|
|
78 |
|
|
|
79 |
|
|
|
80 |
If ''endptr'' is not __NULL__, a pointer to the |
|
|
81 |
character after the last character used in the conversion is |
|
|
82 |
stored in the location referenced by |
|
|
83 |
''endptr''. |
|
|
84 |
|
|
|
85 |
|
|
|
86 |
If no conversion is performed, zero is returned and the |
|
|
87 |
value of ''nptr'' is stored in the location referenced by |
|
|
88 |
''endptr''. |
|
|
89 |
|
|
|
90 |
|
|
|
91 |
If the correct value would cause overflow, plus or minus |
|
|
92 |
__HUGE_VAL__ (__HUGE_VALF__, __HUGE_VALL__) is |
|
|
93 |
returned (according to the sign of the value), and |
|
|
94 |
__ERANGE__ is stored in ''errno''. If the correct |
|
|
95 |
value would cause underflow, zero is returned and |
|
|
96 |
__ERANGE__ is stored in ''errno''. |
|
|
97 |
!!ERRORS |
|
|
98 |
|
|
|
99 |
|
|
|
100 |
__ERANGE__ |
|
|
101 |
|
|
|
102 |
|
|
|
103 |
Overflow or underflow occurred. |
|
|
104 |
!!CONFORMING TO |
|
|
105 |
|
|
|
106 |
|
|
|
107 |
ANSI C describes __strtod__, C99 describes the other two |
|
|
108 |
functions. |
|
|
109 |
!!SEE ALSO |
|
|
110 |
|
|
|
111 |
|
|
|
112 |
atof(3), atoi(3), atol(3), |
|
|
113 |
strtol(3), strtoul(3) |
|
|
114 |
---- |