Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

atoi(3)

atol(3)

isspace(3)

ctype(3)

scanf(3)

strtod(3)

strtol(3)

strtoul(3)



  atof(3)                             CLIX                             atof(3)



  NAME

    atof - Converts a string to a double-precision base 10 number

  LIBRARY

    Standard C Library (libc.a)

  SYNOPSIS

    double atof(
      char *str );

  PARAMETERS

    str   Specifies a pointer to the string to be converted.

  DESCRIPTION

    The atof() 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 atof() function recognizes an optional string of white space
    characters (as defined in isspace(3)), 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.

    Except for its behavior in the event of an error, the atof(str) function
    is equivalent to strtod(str, (char**)NULL).

  EXAMPLES

    To convert a string into a floating-point number with atof():

    #include <stdlib.h>

    main(argc,argv)
    int argc;
    char **argv;
    {
         double number;
         number = atof(argv[1]);
         printf("The number is %6.2f\n",number);
    }

    This program converts a string containing a number, entered at the command
    line, into a floating-point number.

  RETURN VALUES




  2/94 - Intergraph Corporation                                              1






  atof(3)                             CLIX                             atof(3)



    If a correct value causes overflow, +HUGE (as defined in <math.h>) is
    returned (according to the sign of the value), and errno is set to ERANGE.

    If the correct value causes underflow, MINDOUBLE is returned and errno is
    set to ERANGE.

    Otherwise, the double-precision floating-point representation of str is
    returned.

  ERRORS

    [ERANGE]   The correct value results in either an overflow or underflow.

  RELATED INFORMATION

    Functions:  atoi(3), atol(3), isspace(3), ctype(3), scanf(3), strtod(3),
    strtol(3), strtoul(3)





































  2                                              Intergraph Corporation - 2/94




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