1FEGETROUND(3P) POSIX Programmer's Manual FEGETROUND(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 fegetround, fesetround - get and set current rounding direction
13
15 #include <fenv.h>
16
17 int fegetround(void);
18 int fesetround(int round);
19
20
22 The fegetround() function shall get the current rounding direction.
23
24 The fesetround() function shall establish the rounding direction repre‐
25 sented by its argument round. If the argument is not equal to the value
26 of a rounding direction macro, the rounding direction is not changed.
27
29 The fegetround() function shall return the value of the rounding direc‐
30 tion macro representing the current rounding direction or a negative
31 value if there is no such rounding direction macro or the current
32 rounding direction is not determinable.
33
34 The fesetround() function shall return a zero value if and only if the
35 requested rounding direction was established.
36
38 No errors are defined.
39
40 The following sections are informative.
41
43 The following example saves, sets, and restores the rounding direction,
44 reporting an error and aborting if setting the rounding direction
45 fails:
46
47
48 #include <fenv.h>
49 #include <assert.h>
50 void f(int round_dir)
51 {
52 #pragma STDC FENV_ACCESS ON
53 int save_round;
54 int setround_ok;
55 save_round = fegetround();
56 setround_ok = fesetround(round_dir);
57 assert(setround_ok == 0);
58 /* ... */
59 fesetround(save_round);
60 /* ... */
61 }
62
64 None.
65
67 None.
68
70 None.
71
73 The Base Definitions volume of IEEE Std 1003.1-2001, <fenv.h>
74
76 Portions of this text are reprinted and reproduced in electronic form
77 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
78 -- Portable Operating System Interface (POSIX), The Open Group Base
79 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
80 Electrical and Electronics Engineers, Inc and The Open Group. In the
81 event of any discrepancy between this version and the original IEEE and
82 The Open Group Standard, the original IEEE and The Open Group Standard
83 is the referee document. The original Standard can be obtained online
84 at http://www.opengroup.org/unix/online.html .
85
86
87
88IEEE/The Open Group 2003 FEGETROUND(3P)