Commit | Line | Data |
---|---|---|
44e6327a KB |
1 | .\" Copyright (c) 1990 The Regents of the University of California. |
2 | .\" All rights reserved. | |
f11907db | 3 | .\" |
44e6327a KB |
4 | .\" %sccs.include.redist.man% |
5 | .\" | |
6 | .\" @(#)atof.3 6.2 (Berkeley) %G% | |
7 | .\" | |
8 | .TH ATOF 3 "" | |
9 | .UC 7 | |
f11907db | 10 | .SH NAME |
44e6327a | 11 | atof \- convert ASCII string to double |
f11907db KM |
12 | .SH SYNOPSIS |
13 | .nf | |
44e6327a KB |
14 | .ft B |
15 | #include <stdlib.h> | |
16 | ||
17 | double | |
18 | atof(const char *nptr); | |
19 | .ft R | |
f11907db KM |
20 | .fi |
21 | .SH DESCRIPTION | |
44e6327a KB |
22 | The |
23 | .I atof | |
24 | function converts the initial portion of the string pointed to by | |
f11907db | 25 | .I nptr |
44e6327a KB |
26 | to |
27 | .I double | |
28 | representation. | |
f11907db | 29 | .PP |
44e6327a KB |
30 | It is equivalent to: |
31 | .sp | |
32 | .RS | |
33 | strtod(nptr, (char **)NULL); | |
34 | .RE | |
f11907db | 35 | .SH SEE ALSO |
44e6327a KB |
36 | atoi(3), atol(3), strtod(3), strtol(3), strtoul(3) |
37 | .SH STANDARDS | |
38 | .B Atof | |
39 | conforms to ANSI X3.159-1989 (``ANSI C''). | |
f11907db | 40 | .SH BUGS |
44e6327a KB |
41 | This manual page represents intent instead of actual practice. |
42 | While it is intended that | |
43 | .I atof | |
44 | be implemented using | |
45 | .IR strtod (3), | |
46 | this has not yet happened. | |
47 | In the current system, | |
48 | .I atof | |
49 | translates a string in the following form to a double: | |
50 | an optional string of spaces, followed by an optional sign (``+'' or ``-''), | |
51 | followed by a string of digits which may contain a decimal point (``.''), | |
52 | followed by an optional exponent flag (``E'' or ``e''), followed by an | |
53 | optionally signed integer. |