Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ strtod(3C) — Dell System V Release 4 Issue 2.2

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ctype(3C)

strtol(3C)

scanf(3S)



strtod(3C)      UNIX System V(C Programming Language Utilities)      strtod(3C)


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

SYNOPSIS
      #include <stdlib.h>

      double strtod (const char *nptr, char **endptr);

      long double strtold (const char *nptr, char **endptr);

      double atof (const char *nptr);

DESCRIPTION
      strtod returns as a double-precision floating-point number the value
      represented by the character string pointed to by nptr.  The string is
      scanned up to the first unrecognized character.

      strtod recognizes an optional string of ``white-space'' characters [as
      defined by isspace in ctype(3C)], then an optional sign, then a string of
      digits optionally containing a decimal-point character [as specified by
      the current locale; see setlocale(3C)], then an optional exponent part
      including an e or E followed by an optional sign, followed by an integer.

      If the value of endptr is not (char **)NULL, a pointer to the character
      terminating the scan is returned in the location pointed to by endptr.
      If no number can be formed, *endptr is set to nptr, and zero is returned.

      strtold is equivalent to strtod except it returns a long double-precision
      floating-point number.

      atof(nptr) is equivalent to:
            strtod(nptr, (char **)NULL).

SEE ALSO
      ctype(3C), strtol(3C), scanf(3S).

DIAGNOSTICS
      If the correct value would cause overflow, +HUGE 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
      set to ERANGE.

      When the -Xc or -Xa compilation options are used, +HUGEVAL is returned
      instead of +HUGE.









10/89                                                                    Page 1





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