atof man page on IRIX

Man page or keyword search:  
man Server   31559 pages
apropos Keyword Search (all sections)
Output format
IRIX logo
[printable version]



strtod(3C)							    strtod(3C)

NAME
     strtod, atof, strtof, strtold, atold - convert string to double-precision
     or long double-precision number

SYNOPSIS
     #include <stdlib.h>

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

     double atof (const char *nptr);

     float strtof (const char *nptr, char **endptr);

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

     long double atold (const char *nptr);

DESCRIPTION
     Note that the long double routines are only valid for the MIPSpro
     compilers.

     The strtod. strtof, and strtold functions convert the initial portion of
     the string pointed to by nptr, to double, float, and long double
     representation, respectively.  First, they decompose the input string
     into three parts: an initial, possibly empty, sequence of white-space
     characters (as specified by the isspace function), a subject sequence
     resembling a floating-point constant or representing an infinity or NaN;
     and a final string of one or more unrecognized characters, including the
     terminating null character of the input string.  Then, they attempt to
     convert the subject sequence to a floating-point number, and return the
     result.

     The expected form of the subject sequence is as follows:

     -- a nonempty sequence of decimal digits optionally containing a
     decimal-point character, then an optional exponent part followed by an
     optional floating suffix (one of f F l L).	 Either the period or the
     exponent part has to be present.

     -- a 0x or 0X followed by one of the following:
     <hexstring>[p|P][+|-]?<decstring>[f|F|l|L]?
     <hexstring>\.([p|P][+|-]?<decstring>)?[f|F|l|L]?
     \.<hexstring>([p|P][+|-]?<decstring>)?[f|F|l|L]?
     <hexstring>\.<hexstring>([p|P][+|-]?<decstring>)?[f|F|l|L]?

     where <hexstring> is a sequence of one or more hex characters and
     <decstring> is a sequence of one or more decimal characters.  A ? in the
     preceding descriptions means optional.  Notation is as in lex(1).

     An unsuffixed floating constant has type double.  If suffixed by the
     letter f or F, it has type float.	If suffixed by the letter l or L, it
     has type long double.

									Page 1

strtod(3C)							    strtod(3C)

     The significand part of the subject sequence is what occurs before the
     (optional) exponent part.

     Semantics:	 The significand part is interpreted as a (decimal or
     hexadecimal) rational number; the digit sequence in the exponent part is
     interpreted as a decimal integer.	For decimal floating constants, the
     exponent indicates the power of 10 by which the significand part is to be
     scaled.  For decimal constants, the result is either the nearest
     representable value, or the larger or smaller representable value
     immediately adjacent to the nearest representable value.  For hexadecimal
     constants the result is correctly rounded.	 For example, 0x1.8p1f is 3.0
     (float) and 0x1.0p-1 is 0.5 (double).

     -- one of inf or infinity, ignoring case.	In this case, an infinity is
     returned.

     --one of nan or nan(n-char-seq), ignoring case in the nan part, where n-
     char-seq is a sequence of letters, digits, and underscores (_).  In this
     case a quiet NaN is returned.

     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.

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

     atold(nptr) is equivalent to:
	  strtold(nptr, (char **)NULL).

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

NOTE
     Precision may be silently lost if the number of digits comprising the
     floating-point number (i.e., not including the exponent) exceeds the
     value of the constant DBL_DIG (LDBL_DIG) in <float.h>.

DIAGNOSTICS
     If the correct value would cause overflow, _HUGE_VAL 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.

SEE ALSO
     lex(1)

									Page 2

[top]

List of man pages available for IRIX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net