xref: /csrg-svn/lib/libc/stdlib/atof.3 (revision 50283)
148349Scael.\" Copyright (c) 1991 The Regents of the University of California.
242104Sbostic.\" All rights reserved.
320290Smckusick.\"
4*50283Sbostic.\" This code is derived from software contributed to Berkeley by
5*50283Sbostic.\" the American National Standards Committee X3, on Information
6*50283Sbostic.\" Processing Systems.
7*50283Sbostic.\"
842104Sbostic.\" %sccs.include.redist.man%
942104Sbostic.\"
10*50283Sbostic.\"     @(#)atof.3	6.4 (Berkeley) 06/29/91
1142104Sbostic.\"
1248349Scael.Dd
1348349Scael.Dt ATOF 3
1448349Scael.Os
1548349Scael.Sh NAME
1648349Scael.Nm atof
1748349Scael.Nd convert
1848349Scael.Tn ASCII
1948349Scaelstring to double
2048349Scael.Sh SYNOPSIS
2148349Scael.Fd #include <stdlib.h>
2248349Scael.Ft double
2348349Scael.Fn atof "const char *nptr"
2448349Scael.Sh DESCRIPTION
2542104SbosticThe
2648349Scael.Fn atof
2742104Sbosticfunction converts the initial portion of the string pointed to by
2848349Scael.Ar nptr
2942104Sbosticto
3048349Scael.Ar double
3142104Sbosticrepresentation.
3248349Scael.Pp
3342104SbosticIt is equivalent to:
3448349Scael.Bd -literal -offset indent
3542104Sbosticstrtod(nptr, (char **)NULL);
3648349Scael.Ed
3748349Scael.Sh SEE ALSO
3848349Scael.Xr atoi 3 ,
3948349Scael.Xr atol 3 ,
4048349Scael.Xr strtod 3 ,
4148349Scael.Xr strtol 3 ,
4248349Scael.Xr strtoul 3
4348349Scael.Sh STANDARDS
4448349ScaelThe
4548349Scael.Fn atof
4648349Scaelfunction conforms to
4748349Scael.St -ansiC .
4848349Scael.Sh BUGS
4942104SbosticThis manual page represents intent instead of actual practice.
5042104SbosticWhile it is intended that
5148349Scael.Fn atof
5242104Sbosticbe implemented using
5348349Scael.Xr strtod 3 ,
5442104Sbosticthis has not yet happened.
5542104SbosticIn the current system,
5648349Scael.Fn atof
5748349Scaeltranslates a string in the following form to a double: a string of
5848349Scaelleading white space, possibly followed by a sign (``+'' or ``-''),
5948349Scaelfollowed by a digit string which may contain one decimal point (``.''),
6048349Scaelwhich may be followed by either of the exponent flags (``E'' or ``e''),
6148349Scaeland lastly, followed by a signed or unsigned integer.
62