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