HPlogo HP-UX Reference Volume 4 of 5 > s

strtold(3C)

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Index

NAME

strtold() — convert string to long double-precision number

SYNOPSIS

#include <stdlib.h>

long double strtold(const char *str, char **ptr);

DESCRIPTION

strtold() returns as a long double-precision number the value represented by the character string pointed to by str. The string is scanned up to the first unrecognized character.

strtold() 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 radix character, then an optional e or E followed by an optional sign or space, followed by an integer. The radix character is determined by the loaded NLS environment (see setlocale(3C)). If setlocale() has not been called successfully, the default NLS environment, "C" (see lang(5)), is used. The default environment specifies a period (.) as the radix character.

If the value of ptr is not (char **) NULL, the variable to which it points is set to point at the character after the last number, if any, that was recognized. If no number can be formed, *ptr is set to str, and zero is returned.

APPLICATION USAGE

strtold() is thread-safe and async-cancel-safe.

EXTERNAL INFLUENCES

International Code Set Support

Single-byte character code sets are supported.

RETURN VALUE

If the correct value would cause overflow, positive _LDBL_MAX or negative _LDBL_NMAX is returned (according to the sign of the value), and errno is set to ERANGE. The __LDBL_MAX and __LDBL_NMAX macros are provided to assist in checking the return values against _LDBL_MAX and _LDBL_NMAX.

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

AUTHOR

strtold() was developed by HP.

© Hewlett-Packard Development Company, L.P.