1FEGETROUND(3P)             POSIX Programmer's Manual            FEGETROUND(3P)
2
3
4

PROLOG

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
11

NAME

13       fegetround, fesetround — get and set current rounding direction
14

SYNOPSIS

16       #include <fenv.h>
17
18       int fegetround(void);
19       int fesetround(int round);
20

DESCRIPTION

22       The functionality described on this reference page is aligned with  the
23       ISO C  standard.  Any  conflict between the requirements described here
24       and the ISO C standard is unintentional. This  volume  of  POSIX.1‐2008
25       defers to the ISO C standard.
26
27       The fegetround() function shall get the current rounding direction.
28
29       The fesetround() function shall establish the rounding direction repre‐
30       sented by its argument round.  If the argument  is  not  equal  to  the
31       value  of  a  rounding  direction  macro, the rounding direction is not
32       changed.
33

RETURN VALUE

35       The fegetround() function shall return the value of the rounding direc‐
36       tion  macro  representing  the current rounding direction or a negative
37       value if there is no such  rounding  direction  macro  or  the  current
38       rounding direction is not determinable.
39
40       The  fesetround() function shall return a zero value if and only if the
41       requested rounding direction was established.
42

ERRORS

44       No errors are defined.
45
46       The following sections are informative.
47

EXAMPLES

49       The following example saves, sets, and restores the rounding direction,
50       reporting  an  error  and  aborting  if  setting the rounding direction
51       fails:
52
53           #include <fenv.h>
54           #include <assert.h>
55           void f(int round_dir)
56           {
57               #pragma STDC FENV_ACCESS ON
58               int save_round;
59               int setround_ok;
60               save_round = fegetround();
61               setround_ok = fesetround(round_dir);
62               assert(setround_ok == 0);
63               /* ... */
64               fesetround(save_round);
65               /* ... */
66           }
67

APPLICATION USAGE

69       None.
70

RATIONALE

72       None.
73

FUTURE DIRECTIONS

75       None.
76

SEE ALSO

78       The Base Definitions volume of POSIX.1‐2008, <fenv.h>
79
81       Portions of this text are reprinted and reproduced in  electronic  form
82       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
83       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
84       Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
85       cal and Electronics Engineers,  Inc  and  The  Open  Group.   (This  is
86       POSIX.1-2008  with  the  2013  Technical Corrigendum 1 applied.) In the
87       event of any discrepancy between this version and the original IEEE and
88       The  Open Group Standard, the original IEEE and The Open Group Standard
89       is the referee document. The original Standard can be  obtained  online
90       at http://www.unix.org/online.html .
91
92       Any  typographical  or  formatting  errors that appear in this page are
93       most likely to have been introduced during the conversion of the source
94       files  to  man page format. To report such errors, see https://www.ker
95       nel.org/doc/man-pages/reporting_bugs.html .
96
97
98
99IEEE/The Open Group                  2013                       FEGETROUND(3P)
Impressum