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

NAME

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

SYNOPSIS

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

DESCRIPTION

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

RETURN VALUE

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

ERRORS

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

EXAMPLES

48       The following example saves, sets, and restores the rounding direction,
49       reporting  an  error  and  aborting  if  setting the rounding direction
50       fails:
51
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‐2017, <fenv.h>
79
81       Portions of this text are reprinted and reproduced in  electronic  form
82       from  IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
83       table Operating System Interface (POSIX), The Open Group Base  Specifi‐
84       cations  Issue  7, 2018 Edition, Copyright (C) 2018 by the Institute of
85       Electrical and Electronics Engineers, Inc and The Open Group.   In  the
86       event of any discrepancy between this version and the original IEEE and
87       The Open Group Standard, the original IEEE and The Open Group  Standard
88       is  the  referee document. The original Standard can be obtained online
89       at http://www.opengroup.org/unix/online.html .
90
91       Any typographical or formatting errors that appear  in  this  page  are
92       most likely to have been introduced during the conversion of the source
93       files to man page format. To report such errors,  see  https://www.ker
94       nel.org/doc/man-pages/reporting_bugs.html .
95
96
97
98IEEE/The Open Group                  2017                       FEGETROUND(3P)
Impressum