Import OpenBSD's libm (trunk, 4 July 2015) to a new vendor branch
[dragonfly.git] / contrib / openbsd_libm / man / fegetround.3
1 .\"     $OpenBSD: fegetround.3,v 1.3 2013/06/05 03:40:26 tedu Exp $
2 .\"
3 .\" Copyright (c) 2011 Martynas Venckus <martynas@openbsd.org>
4 .\"
5 .\" Permission to use, copy, modify, and distribute this software for any
6 .\" purpose with or without fee is hereby granted, provided that the above
7 .\" copyright notice and this permission notice appear in all copies.
8 .\"
9 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 .\"
17 .Dd $Mdocdate: June 5 2013 $
18 .Dt FEGETROUND 3
19 .Os
20 .Sh NAME
21 .Nm fegetround ,
22 .Nm fesetround
23 .Nd control floating-point rounding direction modes
24 .Sh SYNOPSIS
25 .In fenv.h
26 .Ft int
27 .Fn fegetround void
28 .Ft int
29 .Fn fesetround "int round"
30 .Sh DESCRIPTION
31 These functions provide control of floating-point rounding direction
32 modes.
33 The
34 .Fa round
35 input argument is a value specifying a rounding direction mode and
36 containing any of the values listed below.
37 .Bl -tag -width ".Dv FE_TOWARDZERO"
38 .It Dv FE_TONEAREST
39 Results are rounded to the closest representable value.
40 If the exact result is exactly half way between two representable
41 values, the value whose last binary digit is even (zero) is chosen.
42 This is the default mode.
43 .It Dv FE_DOWNWARD
44 Results are rounded towards negative \*[If].
45 .It Dv FE_UPWARD
46 Results are rounded towards positive \*[If].
47 .It Dv FE_TOWARDZERO
48 Results are rounded towards zero.
49 .El
50 .Pp
51 The
52 .Fn fegetround
53 function gets the current rounding direction.
54 .Pp
55 The
56 .Fn fesetround
57 function establishes the rounding direction represented by
58 .Pa round .
59 If the argument is not equal to the value of a rounding direction
60 macro, the rounding direction is not changed.
61 .Sh RETURN VALUES
62 The
63 .Fn fegetround
64 function returns the current rounding direction.
65 The
66 .Fn fesetround
67 function return zero on success, and non-zero if an error occurred.
68 .Sh SEE ALSO
69 .Xr feclearexcept 3 ,
70 .Xr feenableexcept 3 ,
71 .Xr fegetenv 3
72 .Sh STANDARDS
73 The
74 .Fn fegetround
75 and
76 .Fn fesetround
77 functions conform to
78 .St -isoC-99 .
79 .Sh HISTORY
80 These functions first appeared in
81 .Ox 5.0 .