1fegetround(3M)          Mathematical Library Functions          fegetround(3M)
2
3
4

NAME

6       fegetround, fesetround - get and set current rounding direction
7

SYNOPSIS

9       c99 [ flag... ] file... -lm [ library... ]
10       #include <fenv.h>
11
12       int fegetround(void);
13
14
15       int fesetround(int round);
16
17

DESCRIPTION

19       The fegetround function gets the current rounding direction.
20
21
22       The  fesetround function establishes the rounding direction represented
23       by its argument round. If the argument is not equal to the value  of  a
24       rounding direction macro, the rounding direction is not changed.
25

RETURN VALUES

27       The  fegetround  function  returns  the value of the rounding direction
28       macro representing the current rounding direction, or a negative  value
29       if  there  is  no such rounding direction macro or the current rounding
30       direction is not determinable.
31
32
33       The fesetround function returns a 0 value if and only if the  requested
34       rounding direction was established.
35

ERRORS

37       No errors are defined.
38

EXAMPLES

40       The following example saves, sets, and restores the rounding direction,
41       reporting an error and  aborting  if  setting  the  rounding  direction
42       fails:
43
44       Example 1 Save, set, and restore the rounding direction.
45
46         #include <fenv.h>
47         #include <assert.h>
48         void f(int round_dir)
49         {
50               #pragma STDC FENV_ACCESS ON
51               int save_round;
52               int setround_ok;
53               save_round = fegetround();
54               setround_ok = fesetround(round_dir);
55               assert(setround_ok == 0);
56               /* ... */
57               fesetround(save_round);
58               /* ... */
59         }
60
61

ATTRIBUTES

63       See attributes(5) for descriptions of the following attributes:
64
65
66
67
68       ┌─────────────────────────────┬─────────────────────────────┐
69       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
70       ├─────────────────────────────┼─────────────────────────────┤
71       │Interface Stability          │Standard                     │
72       ├─────────────────────────────┼─────────────────────────────┤
73       │MT-Level                     │MT-Safe                      │
74       └─────────────────────────────┴─────────────────────────────┘
75

SEE ALSO

77       fenv.h(3HEAD), attributes(5), standards(5)
78
79
80
81SunOS 5.11                        12 Jul 2006                   fegetround(3M)
Impressum