]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3p/fegetround.3p
Import of man-pages 1.70
[thirdparty/man-pages.git] / man3p / fegetround.3p
1 .\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved
2 .TH "FEGETROUND" P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
3 .\" fegetround
4 .SH NAME
5 fegetround, fesetround \- get and set current rounding direction
6 .SH SYNOPSIS
7 .LP
8 \fB#include <fenv.h>
9 .br
10 .sp
11 int fegetround(void);
12 .br
13 int fesetround(int\fP \fIround\fP\fB);
14 .br
15 \fP
16 .SH DESCRIPTION
17 .LP
18 The \fIfegetround\fP() function shall get the current rounding direction.
19 .LP
20 The \fIfesetround\fP() function shall establish the rounding direction
21 represented by its argument \fIround\fP. If the
22 argument is not equal to the value of a rounding direction macro,
23 the rounding direction is not changed.
24 .SH RETURN VALUE
25 .LP
26 The \fIfegetround\fP() function shall return the value of the rounding
27 direction macro representing the current rounding
28 direction or a negative value if there is no such rounding direction
29 macro or the current rounding direction is not
30 determinable.
31 .LP
32 The \fIfesetround\fP() function shall return a zero value if and only
33 if the requested rounding direction was established.
34 .SH ERRORS
35 .LP
36 No errors are defined.
37 .LP
38 \fIThe following sections are informative.\fP
39 .SH EXAMPLES
40 .LP
41 The following example saves, sets, and restores the rounding direction,
42 reporting an error and aborting if setting the rounding
43 direction fails:
44 .sp
45 .RS
46 .nf
47
48 \fB#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 \fP
63 .fi
64 .RE
65 .SH APPLICATION USAGE
66 .LP
67 None.
68 .SH RATIONALE
69 .LP
70 None.
71 .SH FUTURE DIRECTIONS
72 .LP
73 None.
74 .SH SEE ALSO
75 .LP
76 The Base Definitions volume of IEEE\ Std\ 1003.1-2001, \fI<fenv.h>\fP
77 .SH COPYRIGHT
78 Portions of this text are reprinted and reproduced in electronic form
79 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
80 -- Portable Operating System Interface (POSIX), The Open Group Base
81 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
82 Electrical and Electronics Engineers, Inc and The Open Group. In the
83 event of any discrepancy between this version and the original IEEE and
84 The Open Group Standard, the original IEEE and The Open Group Standard
85 is the referee document. The original Standard can be obtained online at
86 http://www.opengroup.org/unix/online.html .