Commit | Line | Data |
---|---|---|
877ece0f KB |
1 | .\" Copyright (c) 1990 The Regents of the University of California. |
2 | .\" All rights reserved. | |
3 | .\" | |
4 | .\" %sccs.include.redist.man% | |
5 | .\" | |
6 | .\" @(#)strtod.3 5.1 (Berkeley) %G% | |
7 | .\" | |
8 | .TH STRTOD 3 "" | |
9 | .UC 7 | |
10 | .SH NAME | |
11 | strtod \- convert ASCII string to double | |
12 | .SH SYNOPSIS | |
13 | .nf | |
14 | .ft B | |
15 | #include <stdlib.h> | |
16 | ||
17 | double | |
18 | strtod(const char *nptr, char **endptr); | |
19 | .ft R | |
20 | .fi | |
21 | .SH DESCRIPTION | |
22 | The | |
23 | .I strtod | |
24 | function converts the initial portion of the string | |
25 | pointed to by | |
26 | .I nptr | |
27 | to | |
28 | .I double | |
29 | representation. | |
30 | .PP | |
31 | The expected form of the string is an optional plus (``+'') or minus | |
32 | sign (``-''), followed by a sequence of digits optionally containing | |
33 | a decimal-point character, optionally followed by an exponent. | |
34 | An exponent consists of an ``E'' or ``e'', followed by an optional plus | |
35 | or minus sign, followed by a sequence of digits. | |
36 | .PP | |
37 | Leading white-space characters in the string (as defined by the | |
38 | .IR isspace (3) | |
39 | function) are skipped. | |
40 | .PP | |
41 | The | |
42 | .I strtod | |
43 | function returns the converted value, if any. | |
44 | .PP | |
45 | If | |
46 | .I endptr | |
47 | is not NULL, a pointer to the character after the last character used | |
48 | in the conversion is stored in the location referenced by | |
49 | .IR endptr . | |
50 | .PP | |
51 | If no conversion is performed, zero is returned and the value of | |
52 | .I nptr | |
53 | is stored in the location referenced by | |
54 | .IR endptr . | |
55 | .PP | |
56 | If the correct value would cause overflow, plus or minus | |
57 | .I HUGE_VAL | |
58 | is returned (according to the sign of the value), and | |
59 | .I ERANGE | |
60 | is stored in | |
61 | .IR errno . | |
62 | If the correct value would cause underflow, zero is | |
63 | returned and | |
64 | .I ERANGE | |
65 | is stored in | |
66 | .IR errno . | |
67 | .SH ERRORS | |
68 | .TP | |
69 | [ERANGE] | |
70 | Overflow or underflow occurred. | |
71 | .SH "SEE ALSO" | |
72 | atof(3), atoi(3), atol(3), strtol(3), strtoul(3) | |
73 | .SH STANDARDS | |
74 | .B Strtod | |
75 | conforms to ANSI X3.159-1989 (``ANSI C''). | |
76 | .SH BUGS | |
77 | This manual page represents intent instead of actual practice. | |
78 | The | |
79 | .IR strtod (3) | |
80 | function is not currently available. |