Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ strtod(S) — OpenDesktop Software Development System 3.0.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

atof(S)

ctype(S)

scanf(S)

strtol(S)


 strtod(S)                      6 January 1993                      strtod(S)


 Name

    strtod - convert string to double-precision number

 Syntax


    cc  . . .  -lc


    #include  <stdlib.h>

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


 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 unrecognized character.

    The strtod function recognizes an optional string of ``white-space''
    characters (as defined by isspace in ctype(S)), then an optional sign,
    then a string of digits optionally containing a decimal point, then an
    optional e or E followed by an optional sign or space, followed by an
    integer.

    If the value of ptr is not (char **)NULL, a pointer to the character ter-
    minating the scan is returned in the location pointed to by ptr.  If no
    number can be formed, *ptr is set to str, and zero is returned.  If the
    correct value would cause overflow, +-HUGEVAL (as defined in <math.h>)
    is returned (according to the sign of the value), and errno is set to
    ERANGE.

    If the correct value would cause underflow, zero is returned and errno is
    also set to ERANGE.

 See also

    atof(S), ctype(S), scanf(S), strtol(S)

 Standards conformance

    strtod is conformant with:
    AT&T SVID Issue 2;
    X/Open Portability Guide, Issue 3, 1989;
    and ANSI X3.159-1989 Programming Language -- C.


Typewritten Software • bear@typewritten.org • Edmonds, WA 98026