COHERENT manpages

This page displays the COHERENT manpage for atof() [Convert ASCII strings to floating point].

List of available manpages
Index


atof() -- General Function (libc)

Convert ASCII strings to floating point
#include <stdlib.h>
double atof(string) char * string;

atof converts  string into the binary  representation of a double-precision
floating  point  number.  string  must  be the  ASCII  representation of  a
floating-point  number.   It can  contain  a leading  sign,  any number  of
decimal  digits,  and  a decimal  point.   It  can  be  terminated with  an
exponent, which consists  of the letter `e' or `E'  followed by an optional
leading sign and any number of decimal digits.  For example,

    123e-2

is a string that can be converted by atof().

atof()  ignores  leading  blanks  and  tabs;  it  stops  scanning  when  it
encounters any unrecognized character.

Example

For an example of this function, see the entry for acos().

See Also

atoi(),
atol(),
float,
libc,
long,
printf(),
scanf(),
stdlib.h
ANSI Standard, §7.10.1.1
POSIX Standard, §8.1

Notes

atof does not  check to see if the value  represented by string fits into a
double.  It returns zero if you hand it a string that it cannot interpret.