unixdev.net


Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (SunOS-4.1.3)
Page:
Section:
Apropos / Subsearch:
optional field

STRTOD(3)                  Library Functions Manual                  STRTOD(3)



NAME
       strtod, atof - convert string to double-precision number

SYNOPSIS
       double strtod(str, ptr)
       char *str, **ptr;

       double atof(str)
       char *str;

DESCRIPTION
       strtod()  returns as a double-precision floating-point number the value
       represented by the character string pointed to by str.  The  string  is
       scanned  up  to the first unrecognized character, using string_to_deci-
       mal(3), with fortran_conventions set to 0.

       If the value of ptr is not (char **)NULL, a pointer  to  the  character
       terminating the scan is returned in the location pointed to by ptr.  If
       no number can be formed, *ptr is set to str, and for historical compat-
       ibility,  0.0  is  returned, although a NaN would better match the IEEE
       Floating-Point Standard's intent.

       The radix character  is  defined  by  the  program's  locale  (category
       LC_NUMERIC).  In the "C" locale, or in a locale where the radix charac-
       ter is not defined.  the radix character defaults to a period `.'.

       atof(str) is equivalent to  strtod(str,  (char  **)NULL).   Thus,  when
       atof(str)  returns  0.0  there  is no way to determine whether str con-
       tained a valid numerical string representing 0.0 or an invalid  numeri-
       cal string.

SEE ALSO
       scanf(3V), string_to_decimal(3)

DIAGNOSTICS
       Exponent  overflow  and  underflow produce the results specified by the
       IEEE Standard.  In addition, errno is set to ERANGE.



                                5 October 1989                       STRTOD(3)