xref: /csrg-svn/lib/libc/stdlib/atof.3 (revision 48349)
1*48349Scael.\" Copyright (c) 1991 The Regents of the University of California.
242104Sbostic.\" All rights reserved.
320290Smckusick.\"
442104Sbostic.\" %sccs.include.redist.man%
542104Sbostic.\"
6*48349Scael.\"     @(#)atof.3	6.3 (Berkeley) 04/19/91
742104Sbostic.\"
8*48349Scael.Dd
9*48349Scael.Dt ATOF 3
10*48349Scael.Os
11*48349Scael.Sh NAME
12*48349Scael.Nm atof
13*48349Scael.Nd convert
14*48349Scael.Tn ASCII
15*48349Scaelstring to double
16*48349Scael.Sh SYNOPSIS
17*48349Scael.Fd #include <stdlib.h>
18*48349Scael.Ft double
19*48349Scael.Fn atof "const char *nptr"
20*48349Scael.Sh DESCRIPTION
2142104SbosticThe
22*48349Scael.Fn atof
2342104Sbosticfunction converts the initial portion of the string pointed to by
24*48349Scael.Ar nptr
2542104Sbosticto
26*48349Scael.Ar double
2742104Sbosticrepresentation.
28*48349Scael.Pp
2942104SbosticIt is equivalent to:
30*48349Scael.Bd -literal -offset indent
3142104Sbosticstrtod(nptr, (char **)NULL);
32*48349Scael.Ed
33*48349Scael.Sh SEE ALSO
34*48349Scael.Xr atoi 3 ,
35*48349Scael.Xr atol 3 ,
36*48349Scael.Xr strtod 3 ,
37*48349Scael.Xr strtol 3 ,
38*48349Scael.Xr strtoul 3
39*48349Scael.Sh STANDARDS
40*48349ScaelThe
41*48349Scael.Fn atof
42*48349Scaelfunction conforms to
43*48349Scael.St -ansiC .
44*48349Scael.Sh BUGS
4542104SbosticThis manual page represents intent instead of actual practice.
4642104SbosticWhile it is intended that
47*48349Scael.Fn atof
4842104Sbosticbe implemented using
49*48349Scael.Xr strtod 3 ,
5042104Sbosticthis has not yet happened.
5142104SbosticIn the current system,
52*48349Scael.Fn atof
53*48349Scaeltranslates a string in the following form to a double: a string of
54*48349Scaelleading white space, possibly followed by a sign (``+'' or ``-''),
55*48349Scaelfollowed by a digit string which may contain one decimal point (``.''),
56*48349Scaelwhich may be followed by either of the exponent flags (``E'' or ``e''),
57*48349Scaeland lastly, followed by a signed or unsigned integer.
58