xref: /original-bsd/lib/libc/stdlib/atof.3 (revision ba762ddc)
1.\" Copyright (c) 1991 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)atof.3	6.3 (Berkeley) 04/19/91
7.\"
8.Dd
9.Dt ATOF 3
10.Os
11.Sh NAME
12.Nm atof
13.Nd convert
14.Tn ASCII
15string to double
16.Sh SYNOPSIS
17.Fd #include <stdlib.h>
18.Ft double
19.Fn atof "const char *nptr"
20.Sh DESCRIPTION
21The
22.Fn atof
23function converts the initial portion of the string pointed to by
24.Ar nptr
25to
26.Ar double
27representation.
28.Pp
29It is equivalent to:
30.Bd -literal -offset indent
31strtod(nptr, (char **)NULL);
32.Ed
33.Sh SEE ALSO
34.Xr atoi 3 ,
35.Xr atol 3 ,
36.Xr strtod 3 ,
37.Xr strtol 3 ,
38.Xr strtoul 3
39.Sh STANDARDS
40The
41.Fn atof
42function conforms to
43.St -ansiC .
44.Sh BUGS
45This manual page represents intent instead of actual practice.
46While it is intended that
47.Fn atof
48be implemented using
49.Xr strtod 3 ,
50this has not yet happened.
51In the current system,
52.Fn atof
53translates a string in the following form to a double: a string of
54leading white space, possibly followed by a sign (``+'' or ``-''),
55followed by a digit string which may contain one decimal point (``.''),
56which may be followed by either of the exponent flags (``E'' or ``e''),
57and lastly, followed by a signed or unsigned integer.
58