xref: /386bsd/usr/share/man/cat3/finite.0 (revision a2142627)
1IEEE(3)                   386BSD Programmer's Manual                   IEEE(3)
2
3NNAAMMEE
4     ccooppyyssiiggnn, ddrreemm, ffiinniittee, llooggbb, ssccaallbb ccooppyyssiiggnn, rreemmaaiinnddeerr,, - exponent
5     manipulations
6
7SSYYNNOOPPSSIISS
8     ##iinncclluuddee <<mmaatthh..hh>>
9
10     _d_o_u_b_l_e
11     ccooppyyssiiggnn(_d_o_u_b_l_e _x, _d_o_u_b_l_e _y)
12
13     _d_o_u_b_l_e
14     ddrreemm(_d_o_u_b_l_e _x, _d_o_u_b_l_e _y)
15
16     _i_n_t
17     ffiinniittee(_d_o_u_b_l_e _x)
18
19     _d_o_u_b_l_e
20     llooggbb(_d_o_u_b_l_e _x)
21
22     _d_o_u_b_l_e
23     ssccaallbb(_d_o_u_b_l_e _x, _i_n_t _n)
24
25DDEESSCCRRIIPPTTIIOONN
26     These functions are required for, or recommended by the IEEE standard 754
27     for floating-point arithmetic.
28
29     The ccooppyyssiiggnn() function returns _x with its sign changed to _y's.
30
31     The ddrreemm() function returns the remainder _r := _x - _n*_y where _n is the
32     integer nearest the exact value of _x/_y; moreover if |_n - _x/_y| = 1/2 then
33     _n is even.  Consequently the remainder is computed exactly and |_r| <=
34     |_y|/2. But ddrreemm(_x, _0) is exceptional.  (See below under _D_I_A_G_N_O_S_T_I_C_S.)
35
36     The ffiinniittee() function returns the value 1 just when -infinity < _x <
37     +infinity; otherwise a zero is returned (when |_x| = infinity or _x is _N_a_N
38     or is the VAX's reserved operand).
39
40     The llooggbb() function returns _x's exponent _n, a signed integer converted to
41     double-precision floating-point and so chosen that 1 (<= |_x|2**_n < 2
42     unless _x = 0 or (only on machines that conform to IEEE 754) |_x| =
43     infinity or _x lies between 0 and the Underflow Threshold.  (See below
44     under _B_U_G_S.)
45
46     The Fn calb returns _x*(2**_n) computed, for integer n, without first
47     computing 2*_n.
48
49RREETTUURRNN VVAALLUUEESS
50     The IEEE standard 754 defines ddrreemm(_x, _0) and ddrreemm(_i_n_f_i_n_i_t_y, _y) to be
51     invalid operations that produce a _N_a_N.  On the VAX, ddrreemm(_x, _0) generates
52     a reserved operand fault.  No infinity exists on a VAX.
53
54     IEEE 754 defines llooggbb(+-_i_n_f_i_n_i_t_y) = infinity and llooggbb(_0) = -infinity, and
55     requires the latter to signal Division-by-Zero.  But on a VAX, llooggbb(_0) =
56     1.0 - 2.0**31 = -2,147,483,647.0.  And if the correct value of ssccaallbb()
57     would overflow on a VAX, it generates a reserved operand fault and sets
58     the global variable _e_r_r_n_o to ERANGE.
59
60SSEEEE AALLSSOO
61     floor(3),  math(3),  infnan(3)
62
63HHIISSTTOORRYY
64     The iieeeeee functions appeared in 4.3BSD.
65
66BBUUGGSS
67     Should ddrreemm(_x, _0) and llooggbb(_0) on a VAX signal invalidity by setting _e_r_r_n_o
68     = EDOM ? Should llooggbb(_0) return  -1.7e38?
69
70     IEEE 754 currently specifies that llooggbb(_d_e_n_o_r_m_a_l_i_z_e_d _n_o.) = llooggbb(_t_i_n_i_e_s_t
71     _n_o_r_m_a_l_i_z_e_d _n_o. > _0) but the consensus has changed to the specification in
72     the new proposed IEEE standard p854, namely that llooggbb(_x) satisfy
73
74           1 <= ssccaallbb(|_x|, -_l_o_g_b(_x)) < Radix  ... = 2 for IEEE 754
75
76     for every x except 0, infinity and _N_a_N.  Almost every program that
77     assumes 754's specification will work correctly if llooggbb() follows 854's
78     specification instead.
79
80     IEEE 754 requires ccooppyyssiiggnn(_x, _N_a_N)) = +-_x but says nothing else about the
81     sign of a _N_a_N.  A _N_a_N _Not _a _Number) is similar in spirit to the VAX's
82     reserved operand, but very different in important details.  Since the
83     sign bit of a reserved operand makes it look negative,
84
85           ccooppyyssiiggnn(_x, _r_e_s_e_r_v_e_d _o_p_e_r_a_n_d) = -_x;
86
87     should this return the reserved operand instead?
88
894.3 Berkeley Distribution         May 6, 1991                                2
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133