new copyright; att/bsd/shared
[unix-history] / usr / src / lib / libc / stdlib / atof.3
CommitLineData
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 11atof \- convert ASCII string to double
f11907db
KM
12.SH SYNOPSIS
13.nf
44e6327a
KB
14.ft B
15#include <stdlib.h>
16
17double
18atof(const char *nptr);
19.ft R
f11907db
KM
20.fi
21.SH DESCRIPTION
44e6327a
KB
22The
23.I atof
24function converts the initial portion of the string pointed to by
f11907db 25.I nptr
44e6327a
KB
26to
27.I double
28representation.
f11907db 29.PP
44e6327a
KB
30It is equivalent to:
31.sp
32.RS
33strtod(nptr, (char **)NULL);
34.RE
f11907db 35.SH SEE ALSO
44e6327a
KB
36atoi(3), atol(3), strtod(3), strtol(3), strtoul(3)
37.SH STANDARDS
38.B Atof
39conforms to ANSI X3.159-1989 (``ANSI C'').
f11907db 40.SH BUGS
44e6327a
KB
41This manual page represents intent instead of actual practice.
42While it is intended that
43.I atof
44be implemented using
45.IR strtod (3),
46this has not yet happened.
47In the current system,
48.I atof
49translates a string in the following form to a double:
50an optional string of spaces, followed by an optional sign (``+'' or ``-''),
51followed by a string of digits which may contain a decimal point (``.''),
52followed by an optional exponent flag (``E'' or ``e''), followed by an
53optionally signed integer.