1decimal_to_floating(3C) Standard C Library Functions decimal_to_floating(3C)
2
3
4
6 decimal_to_floating, decimal_to_single, decimal_to_double, deci‐
7 mal_to_extended, decimal_to_quadruple - convert decimal record to
8 floating-point value
9
11 #include <floatingpoint.h>
12
13 void decimal_to_single(single *px, decimal_mode *pm,
14 decimal_record *pd, fp_exception_field_type *ps);
15
16
17 void decimal_to_double(double *px, decimal_mode *pm,
18 decimal_record *pd, fp_exception_field_type *ps);
19
20
21 void decimal_to_extended(extended *px, decimal_mode *pm,
22 decimal_record *pd, fp_exception_field_type *ps);
23
24
25 void decimal_to_quadruple(quadruple *px, decimal_mode *pm,
26 decimal_record *pd, fp_exception_field_type *ps);
27
28
30 These functions convert the decimal record *pd to a floating-point
31 value *px observing the rounding direction specified in *pm and setting
32 *ps to reflect any floating-point exceptions that occur.
33
34
35 When pd->fpclass is fp_zero, fp_infinity, fp_quiet, or fp_signaling,
36 *px is set to zero, infinity, a quiet NaN, or a signaling NaN, respec‐
37 tively, with the sign indicated by pd->sign. All other fields in *pd
38 are ignored.
39
40
41 When pd->fpclass is fp_normal or fp_subnormal, pd->ds must contain a
42 null-terminated string of one or more ASCII digits representing a non-
43 zero integer m, and pd->ndigits must be equal to the length of this
44 string. Then *px is set to a correctly rounded approximation to
45
46 −1**(pd->sign) * m * 10**(pd->exponent)
47
48
49
50 pd->more can be set to a non-zero value to indicate that insignificant
51 trailing digits were omitted from pd->ds. In this case, m is replaced
52 by m + delta in the expression above, where delta is some tiny positive
53 fraction.
54
55
56 The converted value is rounded according to the rounding direction
57 specified in pm->rd. pm->df and pm->ndigits are not used.
58
59
60 On exit, *ps contains a bitwise OR of flags corresponding to any float‐
61 ing-point exceptions that occurred. The only possible exceptions are
62 underflow, overflow, and inexact. If no floating-point exceptions
63 occurred, *ps is set to zero.
64
66 See attributes(5) for descriptions of the following attributes:
67
68
69
70
71 ┌─────────────────────────────┬─────────────────────────────┐
72 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
73 ├─────────────────────────────┼─────────────────────────────┤
74 │MT-Level │MT-Safe │
75 └─────────────────────────────┴─────────────────────────────┘
76
78 scanf(3C), string_to_decimal(3C), strtod(3C), attributes(5)
79
80
81
82SunOS 5.11 1 Oct 2001 decimal_to_floating(3C)