Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ strtod(3) — Ultrix-11 3.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

atof(3)

ctype(3)

scanf(3s)

strtol(3)

strtod(3)

NAME

strtod − convert string to double-precision number

SYNTAX

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

DESCRIPTION

The strtod subroutine 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 subroutine recognizes an optional string of “white-space” characters, as defined by isspace in ctype(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. 

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 zero is returned.

NOTE

The atof(str) subroutine is equivalent to strtod (str, (char ∗∗)NULL)". 

DIAGNOSTICS

If the correct value would cause overflow, ±HUGE is returned (according to the sign of the value), and the global variable errno is set to ERANGE.  If the correct value would cause underflow, zero is returned and the global variable errno is set to ERANGE. 

SEE ALSO

atof(3), ctype(3), scanf(3s), strtol(3)

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