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