HP 3000 Manuals

strtod [ HP C/iX Library Reference Manual ] MPE/iX 5.0 Documentation


HP C/iX Library Reference Manual

strtod 

Converts a string to a double-precision, floating-point number.

Syntax 

     #include <stdlib.h>
     double strtod (const char *str, char **ptr);

Parameters 

str           A pointer to a character string to be converted.

ptr           If ptr is not NULL, a pointer to the character terminating
              the scan is stored in the object pointed to by ptr.

Return Values 

x             A double-precision floating-point number resulting from the
              successful conversion of the string.

0             Indicates failure unless the value pointed to by str is
              zero.

                 *   If *ptr is set to str, no number can be formed.

                 *   If *ptr is greater than str, the value pointed to by
                     *str is zero.

                 *   If errno is set to ERANGE, the correct value of the
                     conversion would cause an underflow.

+-HUGE_VAL    The conversion would cause an overflow; errno is set to
              ERANGE.

Description 

The strtod() function 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 unrecognizable character.

The string must contain a decimal constant or a floating-point constant
that may optionally be preceded by white space.  The complete string may
contain the following in the order listed:

   1.  Optional white-space characters (as defined by isspace() ).

   2.  Optional sign.

   3.  Required string of digits, optionally containing a decimal point.

   4.  Optional e or E.

   5.  Optional sign or space.

   6.  Integer.

See Also 

strtol(), strtoul(), atof(), ANSI C 4.10.1.4



MPE/iX 5.0 Documentation