1fpgetround(3C)           Standard C Library Functions           fpgetround(3C)
2
3
4

NAME

6       fpgetround,  fpsetround, fpgetmask, fpsetmask, fpgetsticky, fpsetsticky
7       - IEEE floating-point environment control
8

SYNOPSIS

10       #include <ieeefp.h>
11
12       fp_rnd fpgetround(void);
13
14
15       fp_rnd fpsetround(fp_rnd rnd_dir);
16
17
18       fp_except fpgetmask(void);
19
20
21       fp_except fpsetmask(fp_except mask);
22
23
24       fp_except fpgetsticky(void);
25
26
27       fp_except fpsetsticky(fp_except sticky);
28
29

DESCRIPTION

31       There are five floating-point exceptions:
32
33           o      divide-by-zero,
34
35           o      overflow,
36
37           o      underflow,
38
39           o      imprecise (inexact) result, and
40
41           o      invalid operation.
42
43
44       When a floating-point exception occurs, the corresponding sticky bit is
45       set  (1),  and  if  the  mask bit is enabled (1), the trap takes place.
46       These routines let the user change the behavior on occurrence of any of
47       these  exceptions,  as  well  as change the rounding mode for floating-
48       point operations.
49
50
51       The mask argument is formed by the logical OR operation of the  follow‐
52       ing floating-point exception masks:
53
54         FP_X_INV       /* invalid operation exception */
55         FP_X_OFL       /* overflow exception */
56         FP_X_UFL       /* underflow exception */
57         FP_X_DZ        /* divide-by-zero exception */
58         FP_X_IMP       /* imprecise (loss of precision) */
59
60
61
62       The  following  floating-point rounding modes are passed to  fpsetround
63       and returned by  fpgetround().
64
65         FP_RN       /* round to nearest representative number */
66         FP_RP       /* round to plus infinity */
67         FP_RM       /* round to minus infinity */
68         FP_RZ       /* round to zero (truncate) */
69
70
71
72       The default environment is rounding mode set to nearest (FP_RN) and all
73       traps disabled.
74
75
76       The  fpsetsticky()  function modifies all sticky flags. The fpsetmask()
77       function changes all mask bits. The  fpsetmask()  function  clears  the
78       sticky bit corresponding to any exception being enabled.
79

RETURN VALUES

81       The fpgetround() function returns the current rounding mode.
82
83
84       The fpsetround() function sets the rounding mode and returns the previ‐
85       ous rounding mode.
86
87
88       The fpgetmask() function returns the current exception masks.
89
90
91       The fpsetmask() function sets the exception masks and returns the  pre‐
92       vious setting.
93
94
95       The fpgetsticky() function returns the current exception sticky flags.
96
97
98       The fpsetsticky() function sets (clears) the exception sticky flags and
99       returns the previous setting.
100

USAGE

102       The C programming language requires  truncation  (round  to  zero)  for
103       floating  point  to integral conversions. The current rounding mode has
104       no effect on these conversions.
105
106
107       The sticky bit must be cleared to recover from the trap   and  proceed.
108       If  the  sticky bit is not cleared before the next trap occurs, a wrong
109       exception type may be signaled.
110
111
112       Individual  bits  may  be  examined  using  the  constants  defined  in
113       <ieeefp.h>.
114

ATTRIBUTES

116       See attributes(5) for descriptions of the following attributes:
117
118
119
120
121       ┌─────────────────────────────┬─────────────────────────────┐
122       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
123       ├─────────────────────────────┼─────────────────────────────┤
124       │MT-Level                     │MT-Safe                      │
125       └─────────────────────────────┴─────────────────────────────┘
126

SEE ALSO

128       isnand(3C), attributes(5)
129
130
131
132SunOS 5.11                        29 Dec 1996                   fpgetround(3C)
Impressum