decimal_to_double(3C)
NAME
decimal_to_floating, decimal_to_single, decimal_to_double,
decimal_to_extended, decimal_to_quadruple - convert decimal
record to floating-point value
SYNOPSIS
#include <floatingpoint.h>
void decimal_to_single(single *px, decimal_mode *pm,
decimal_record *pd, fp_exception_field_type *ps);
void decimal_to_double(double *px, decimal_mode *pm,
decimal_record *pd, fp_exception_field_type *ps);
void decimal_to_extended(extended *px, decimal_mode *pm,
decimal_record *pd, fp_exception_field_type *ps);
void decimal_to_quadruple(quadruple *px, decimal_mode *pm,
decimal_record *pd, fp_exception_field_type *ps);
DESCRIPTION
The decimal_to_floating() functions convert the decimal
record at *pd into a floating-point value at *px, observing
the modes specified in *pm and setting exceptions in *ps. If
there are no IEEE exceptions, *ps will be zero.
pd->sign and pd->fpclass are always taken into account. pd-
>exponent, pd->ds and pd->ndigits are used when pd->fpclass
is fp_normal or fp_subnormal. In these cases pd->ds must
contain one or more ascii digits followed by a NULL and pd-
>ndigits is assumed to be the length of the string pd->ds.
Notice that for efficiency reasons, the assumption that pd-
>ndigits == strlen(pd->ds) is NEVER verified.
On output, *px is set to a correctly rounded approximation
to
(pd->sign)*(pd->ds)*10**(pd->exponent)
Thus if pd->exponent == -2 and pd->ds == "1234", *px will
get 12.34 rounded to storage precision. pd->ds cannot have
more than DECIMAL_STRING_LENGTH-1 significant digits because
one character is used to terminate the string with a NULL.
If pd->more != 0 on input then additional nonzero digits
follow those in pd->ds; fp_inexact is set accordingly on
output in *ps.
*px is correctly rounded according to the IEEE rounding
modes in pm->rd. *ps is set to contain fp_inexact,
fp_underflow, or fp_overflow if any of these arise.
pm->df and pm->ndigits are not used.
strtod(3C), scanf(3C), fscanf(3C), and sscanf(3C) all use
decimal_to_double().
ATTRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
____________________________________________________________
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
|_____________________________|_____________________________|
| MT-Level | MT-Safe |
|_____________________________|_____________________________|
SEE ALSO
fscanf(3C), scanf(3C), sscanf(3C), strtod(3C), attributes(5)
Man(1) output converted with
man2html