summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMartynas Venckus <martynas@cvs.openbsd.org>2011-05-25 21:28:44 +0000
committerMartynas Venckus <martynas@cvs.openbsd.org>2011-05-25 21:28:44 +0000
commit20cd81ec557e8a22f73edab97e56e3e67b90b2a1 (patch)
tree29cddab9677f323df09ef0f8650eb7d7d19a4413 /lib
parentddbd213814969b4db768a9b4f68fdd531b82829e (diff)
Document C99 floating-point environment.
Diffstat (limited to 'lib')
-rw-r--r--lib/libm/Makefile57
-rw-r--r--lib/libm/man/feclearexcept.3170
-rw-r--r--lib/libm/man/feenableexcept.387
-rw-r--r--lib/libm/man/fegetenv.3127
-rw-r--r--lib/libm/man/fegetround.381
5 files changed, 502 insertions, 20 deletions
diff --git a/lib/libm/Makefile b/lib/libm/Makefile
index 1ec51c2f76c..0fa0487405c 100644
--- a/lib/libm/Makefile
+++ b/lib/libm/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.78 2011/04/28 19:31:22 todd Exp $
+# $OpenBSD: Makefile,v 1.79 2011/05/25 21:28:43 martynas Exp $
# $NetBSD: Makefile,v 1.28 1995/11/20 22:06:19 jtc Exp $
#
# @(#)Makefile 5.1beta 93/09/24
@@ -182,24 +182,41 @@ SRCS+= ${LONG_SRCS}
.endif
MAN+= acos.3 acosh.3 asin.3 asinh.3 atan.3 atan2.3 atanh.3 ceil.3 \
- cos.3 cosh.3 erf.3 exp.3 fabs.3 fdim.3 floor.3 fmax.3 fmod.3 hypot.3 \
- logb.3 j0.3 lgamma.3 lrint.3 lround.3 math.3 nan.3 remainder.3 \
- rint.3 round.3 sin.3 sinh.3 sqrt.3 tan.3 tanh.3 trunc.3 \
- copysign.3 ilogb.3 nextafter.3 scalbn.3 cimag.3 conj.3 cproj.3
+ cimag.3 conj.3 copysign.3 cos.3 cosh.3 cproj.3 erf.3 exp.3 \
+ fabs.3 fdim.3 feclearexcept.3 feenableexcept.3 fegetenv.3 \
+ fegetround.3 floor.3 fmax.3 fmod.3 hypot.3 ilogb.3 j0.3 \
+ lgamma.3 logb.3 lrint.3 lround.3 math.3 nan.3 nextafter.3 \
+ remainder.3 rint.3 round.3 scalbn.3 sin.3 sinh.3 sqrt.3 \
+ tan.3 tanh.3 trunc.3
MLINKS+=erf.3 erfc.3
-MLINKS+=exp.3 exp2.3 exp.3 expm1.3 exp.3 log.3 exp.3 log2.3 \
- exp.3 log10.3 exp.3 log1p.3 exp.3 pow.3
+MLINKS+=exp.3 exp2.3
+MLINKS+=exp.3 expm1.3
+MLINKS+=exp.3 log.3
+MLINKS+=exp.3 log10.3
+MLINKS+=exp.3 log1p.3
+MLINKS+=exp.3 log2.3
+MLINKS+=exp.3 pow.3
+MLINKS+=feclearexcept.3 fegetexceptflag.3
+MLINKS+=feclearexcept.3 feraiseexcept.3
+MLINKS+=feclearexcept.3 fesetexceptflag.3
+MLINKS+=feclearexcept.3 fetestexcept.3
+MLINKS+=feenableexcept.3 fedisableexcept.3
+MLINKS+=feenableexcept.3 fegetexcept.3
+MLINKS+=fegetenv.3 feholdexcept.3
+MLINKS+=fegetenv.3 fesetenv.3
+MLINKS+=fegetenv.3 feupdateenv.3
+MLINKS+=fegetround.3 fesetround.3
MLINKS+=fmax.3 fmin.3
MLINKS+=hypot.3 cabs.3
-MLINKS+=scalbn.3 scalbln.3
-MLINKS+=logb.3 scalb.3
-MLINKS+=logb.3 significand.3
MLINKS+=j0.3 j1.3 j0.3 jn.3 j0.3 y0.3 j0.3 y1.3 j0.3 yn.3
MLINKS+=lgamma.3 gamma.3 lgamma.3 tgamma.3
+MLINKS+=logb.3 scalb.3
+MLINKS+=logb.3 significand.3
MLINKS+=lrint.3 llrint.3
MLINKS+=lround.3 llround.3
MLINKS+=remainder.3 drem.3 remainder.3 remquo.3
+MLINKS+=scalbn.3 scalbln.3
MLINKS+=sqrt.3 cbrt.3
# float versions
@@ -213,13 +230,14 @@ MLINKS+=atanh.3 atanhf.3
MLINKS+=ceil.3 ceilf.3
MLINKS+=cimag.3 cimagf.3
MLINKS+=conj.3 conjf.3
+MLINKS+=copysign.3 copysignf.3
MLINKS+=cos.3 cosf.3
MLINKS+=cosh.3 coshf.3
MLINKS+=cproj.3 cprojf.3
MLINKS+=erf.3 erfcf.3
MLINKS+=erf.3 erff.3
-MLINKS+=exp.3 expf.3
MLINKS+=exp.3 exp2f.3
+MLINKS+=exp.3 expf.3
MLINKS+=exp.3 expm1f.3
MLINKS+=exp.3 log10f.3
MLINKS+=exp.3 log1pf.3
@@ -234,11 +252,7 @@ MLINKS+=fmax.3 fminf.3
MLINKS+=fmod.3 fmodf.3
MLINKS+=hypot.3 cabsf.3
MLINKS+=hypot.3 hypotf.3
-MLINKS+=copysign.3 copysignf.3
MLINKS+=ilogb.3 ilogbf.3
-MLINKS+=nextafter.3 nextafterf.3
-MLINKS+=scalbn.3 scalbnf.3
-MLINKS+=scalbln.3 scalblnf.3
MLINKS+=j0.3 j0f.3
MLINKS+=j0.3 j1f.3
MLINKS+=j0.3 jnf.3
@@ -251,17 +265,20 @@ MLINKS+=lgamma.3 tgammaf.3
MLINKS+=logb.3 logbf.3
MLINKS+=logb.3 scalbf.3
MLINKS+=logb.3 significandf.3
-MLINKS+=lrint.3 lrintf.3
MLINKS+=lrint.3 llrintf.3
-MLINKS+=lround.3 lroundf.3
+MLINKS+=lrint.3 lrintf.3
MLINKS+=lround.3 llroundf.3
+MLINKS+=lround.3 lroundf.3
MLINKS+=math.3 mathf.3
MLINKS+=nan.3 nanf.3
+MLINKS+=nextafter.3 nextafterf.3
MLINKS+=remainder.3 dremf.3
MLINKS+=remainder.3 remainderf.3
MLINKS+=remainder.3 remquof.3
MLINKS+=rint.3 rintf.3
MLINKS+=round.3 roundf.3
+MLINKS+=scalbln.3 scalblnf.3
+MLINKS+=scalbn.3 scalbnf.3
MLINKS+=sin.3 sinf.3
MLINKS+=sinh.3 sinhf.3
MLINKS+=sqrt.3 cbrtf.3
@@ -275,19 +292,19 @@ MLINKS+=acos.3 acosl.3
MLINKS+=asin.3 asinl.3
MLINKS+=atan.3 atanl.3
MLINKS+=atan2.3 atan2l.3
+MLINKS+=copysign.3 copysignl.3
MLINKS+=cos.3 cosl.3
MLINKS+=exp.3 exp2l.3
MLINKS+=fabs.3 fabsl.3
MLINKS+=fdim.3 fdiml.3
MLINKS+=fmax.3 fmaxl.3
MLINKS+=fmax.3 fminl.3
-MLINKS+=copysign.3 copysignl.3
MLINKS+=ilogb.3 ilogbl.3
-MLINKS+=scalbn.3 scalbnl.3
-MLINKS+=scalbln.3 scalblnl.3
MLINKS+=logb.3 logbl.3
MLINKS+=nan.3 nanl.3
MLINKS+=rint.3 rintl.3
+MLINKS+=scalbln.3 scalblnl.3
+MLINKS+=scalbn.3 scalbnl.3
MLINKS+=sin.3 sinl.3
MLINKS+=sqrt.3 sqrtl.3
MLINKS+=tan.3 tanl.3
diff --git a/lib/libm/man/feclearexcept.3 b/lib/libm/man/feclearexcept.3
new file mode 100644
index 00000000000..9a6eaf6a500
--- /dev/null
+++ b/lib/libm/man/feclearexcept.3
@@ -0,0 +1,170 @@
+.\" $OpenBSD: feclearexcept.3,v 1.1 2011/05/25 21:28:43 martynas Exp $
+.\"
+.\" Copyright (c) 2011 Martynas Venckus <martynas@openbsd.org>
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.Dd $Mdocdate: May 25 2011 $
+.Dt FECLEAREXCEPT 3
+.Os
+.Sh NAME
+.Nm feclearexcept ,
+.Nm fegetexceptflag ,
+.Nm feraiseexcept ,
+.Nm fesetexceptflag ,
+.Nm fetestexcept
+.Nd access floating-point status flags
+.Sh SYNOPSIS
+.Fd #include <fenv.h>
+.Ft int
+.Fn feclearexcept "int excepts"
+.Ft int
+.Fn fegetexceptflag "fexcept_t *flagp" "int excepts"
+.Ft int
+.Fn feraiseexcept "int excepts"
+.Ft int
+.Fn fesetexceptflag "const fexcept_t *flagp" "int excepts"
+.Ft int
+.Fn fetestexcept "int excepts"
+.Sh DESCRIPTION
+These functions provide access to the floating-point status flags.
+The
+.Fa excepts
+input argument is a bitmask specifying an exception type and
+containing any of the values listed below.
+.Bl -tag -width ".Dv FE_DIVBYZERO"
+.It Dv FE_DIVBYZERO
+A divide-by-zero exception occurs when the program attempts to
+divide a finite non-zero number by zero.
+.It Dv FE_INEXACT
+An inexact exception is raised whenever there is a loss of precision
+due to rounding.
+.It Dv FE_INVALID
+Invalid operation exceptions occur when a program attempts to
+perform calculations for which there is no reasonable representable
+answer.
+
+For instance, subtraction of infinities, division of zero by zero,
+ordered comparison involving \*(Nas, and taking the square root of a
+negative number are all invalid operations.
+.It Dv FE_OVERFLOW
+An overflow exception occurs when the magnitude of the result of a
+computation is too large to fit in the destination type.
+.It Dv FE_UNDERFLOW
+Underflow occurs when the result of a computation is too close to zero
+to be represented as a non-zero value in the destination type.
+.It Dv FE_DENORMAL
+Denormalization exception occurs when the result of a floating-point
+expression is a denormalized number.
+
+This is available only on the floating-point implementations of
+amd64 and i386 processors.
+.El
+.Pp
+Additionally, the macro
+.Dv FE_ALL_EXCEPT
+is simply the bitwise OR of all floating-point exception macros
+listed above.
+.Pp
+The
+.Fn feclearexcept
+function clears the floating-point exceptions represented by
+.Fa excepts .
+.Pp
+The
+.Fn fegetexceptflag
+function stores representation of the states of the floating-point
+flags indicated by
+.Pa excepts
+in the object pointed to by
+.Pa flagp .
+.Pp
+The
+.Fn feraiseexcept
+funtion raises floating-point exceptions represented by
+.Pa excepts .
+.Pp
+The
+.Fn fesetexceptflag
+function sets the floating-point status flags indicated by
+.Pa excepts
+to the states stored in the object pointed to by
+.Pa flagp .
+The value of
+.Pa flagp
+shall have been set by a previous call to
+.Fn fegetexceptflag
+whose second argument represented at least those floating-point
+exceptions represented by
+.Pa excepts .
+This function does not raise floating-point exceptions, but only
+sets the state of the flags.
+.Pp
+The
+.Fn fetesteexcept
+function determines which of a specified subset of the floating-point
+exception flags are currently set.
+The
+.Pa excepts
+specifies the floating-point status flags to be queried.
+.Sh RETURN VALUES
+The
+.Fn feclearexcept ,
+.Fn fegetexceptflag ,
+.Fn feraiseexcept ,
+and
+.Fn fesetexceptflag
+functions return zero on success, and non-zero if an error occurred.
+The
+.Fn fetestexcept
+function returns bitmask of a specified subset of the floating-point
+exception flags are currently set.
+.Sh SEE ALSO
+.Xr fegetround 3 ,
+.Xr fegetenv 3 ,
+.Xr feenableexcept 3
+.Sh STANDARDS
+The
+.Fn feclearexcept ,
+.Fn fegetexceptflag ,
+.Fn feraiseexcept ,
+.Fn fesetexceptflag ,
+and
+.Fn fetestexcept
+functions conform to
+.St -isoC-99 .
+.Pp
+The return types for
+.Fn feclearexcept ,
+.Fn fegetexceptflag ,
+.Fn feraiseexcept ,
+and
+.Fn fesetexceptflag
+are
+.Vt int
+for alignment with
+.St -isoC-99
+Defect Report #202.
+.Sh HISTORY
+These functions first appeared in
+.Ox 5.0 .
+.Sh CAVEATS
+On some architectures,
+.Fn feraiseexcept
+function additionally raises the
+.Dq inexact
+floating-point exception whenever it raises the
+.Dq overflow
+or
+.Dq underflow
+floating-point exception.
diff --git a/lib/libm/man/feenableexcept.3 b/lib/libm/man/feenableexcept.3
new file mode 100644
index 00000000000..d550c6575eb
--- /dev/null
+++ b/lib/libm/man/feenableexcept.3
@@ -0,0 +1,87 @@
+.\" $OpenBSD: feenableexcept.3,v 1.1 2011/05/25 21:28:43 martynas Exp $
+.\"
+.\" Copyright (c) 2011 Martynas Venckus <martynas@openbsd.org>
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.Dd $Mdocdate: May 25 2011 $
+.Dt FEENABLEEXCEPT 3
+.Os
+.Sh NAME
+.Nm feenableexcept ,
+.Nm fedisableexcept ,
+.Nm fegetexcept
+.Nd control floating-point exception masks
+.Sh SYNOPSIS
+.Fd #include <fenv.h>
+.Ft int
+.Fn feenableexcept "int excepts"
+.Ft int
+.Fn fedisableexcept "int excepts"
+.Ft int
+.Fn fegetexcept void
+.Sh DESCRIPTION
+These functions provide control of the floating-point exception
+masks.
+The
+.Fa excepts
+input argument is a bitmask specifying an exception type and
+containing any of the values listed in
+.Xr feclearexcept 3 .
+.El
+.Pp
+The
+.Fn feenableexcept
+function unmasks the floating-point exceptions represented by
+.Fa excepts .
+The future floating-point operations that produce
+.Fa excepts
+will trap, and a
+.Dv SIGFPE
+will be delivered to the process.
+.Pp
+The
+.Fn fedisableexcept
+function masks the floating-point exceptions represented by
+.Fa excepts .
+All exceptions are masked by default.
+.Pp
+The
+.Fn fegetexcept
+function returns the current exception mask.
+.Sh RETURN VALUES
+The
+.Fn feenableexcept ,
+and
+.Fn fedisableexcept
+functions return the previous exception mask.
+The
+.Fn fegetexcept
+function returns the current exception mask.
+.Sh SEE ALSO
+.Xr sigaction 2 ,
+.Xr feclearexcept 3 ,
+.Xr fegetround 3 ,
+.Xr fegetenv 3
+.Sh STANDARDS
+The
+.Fn feenableexcept ,
+.Fn fedisableexcept ,
+and
+.Fn fegetexcept
+functions are
+.Ox
+extensions.
+.Sh HISTORY
+These functions first appeared in
+.Ox 5.0 .
diff --git a/lib/libm/man/fegetenv.3 b/lib/libm/man/fegetenv.3
new file mode 100644
index 00000000000..cb6553e5c63
--- /dev/null
+++ b/lib/libm/man/fegetenv.3
@@ -0,0 +1,127 @@
+.\" $OpenBSD: fegetenv.3,v 1.1 2011/05/25 21:28:43 martynas Exp $
+.\"
+.\" Copyright (c) 2011 Martynas Venckus <martynas@openbsd.org>
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.Dd $Mdocdate: May 25 2011 $
+.Dt FEGETENV 3
+.Os
+.Sh NAME
+.Nm fegetenv ,
+.Nm feholdexcept ,
+.Nm fesetenv ,
+.Nm feupdateenv
+.Nd manage floating-point environment
+.Sh SYNOPSIS
+.Fd #include <fenv.h>
+.Ft int
+.Fn fegetenv "fenv_t *envp"
+.Ft int
+.Fn feholdexcept "fenv_t *envp"
+.Ft int
+.Fn fesetenv "const fenv_t *envp"
+.Ft int
+.Fn feupdateenv "const fenv_t *envp"
+.Sh DESCRIPTION
+These functions manage the floating-point environment -- status
+flags, rounding direction modes and exception masks -- as one entity.
+The
+.Fa envp
+input argument is an object representing floating-point environment.
+The macro
+.Dv FE_DFL_ENV
+represents the default floating-point environment -- the one installed
+at program startup.
+.Pp
+The
+.Fn fegetenv
+function stores the current floating-point environment in the object
+pointed to by
+.Pa envp .
+.Pp
+The
+.Fn feholdexcept
+function saves the current floating-point environment in the object
+pointed to by
+.Pa envp ,
+clears the floating-point status flags, and then installs a non-stop
+(continue on floating-point exceptions) mode for all floating-point
+exceptions.
+.Pp
+The
+.Fn fesetenv
+function establishes the floating-point environment represented by
+the object pointed to by
+.Pa envp .
+The argument
+.Pa envp
+shall point to an object set by a call to
+.Fn fegetenv
+or
+.Fn feholdexcept ,
+or equal the macro
+.Dv FE_DFL_ENV .
+Note that
+.Fn fesetenv
+merely installs the state of the floating-point status flags
+represented through its argument, and does not raise these
+floating-point exceptions.
+.Pp
+The
+.Fn feupdateenv
+function saves the currently raised floating-point exceptions in
+its automatic storage, installs the floating-point environment
+represented by the object pointed to by
+.Pa envp ,
+and then raises the saved floating-point exceptions.
+The argument
+.Pa envp
+shall point to an object set by a call to
+.Fn feholdexcept
+or
+.Fn fegetenv ,
+or equal the macro
+.Dv FE_DFL_ENV .
+.Sh RETURN VALUES
+The
+.Fn fegetenv ,
+.Fn feholdexcept ,
+.Fn fesetenv ,
+and
+.Fn feupdateenv
+functions return zero on success, and non-zero if an error occurred.
+.Sh SEE ALSO
+.Xr feclearexcept 3 ,
+.Xr fegetround 3 ,
+.Xr feenableexcept 3
+.Sh STANDARDS
+The
+.Fn fegetenv ,
+.Fn feholdexcept ,
+.Fn fesetenv ,
+and
+.Fn feupdateenv
+functions conform to
+.St -isoC-99 .
+.Pp
+The return types for
+.Fn fegetenv ,
+.Fn fesetenv ,
+and
+.Fn feupdateenv
+are
+.Vt int
+for alignment with
+.St -isoC-99
+Defect Report #202.
diff --git a/lib/libm/man/fegetround.3 b/lib/libm/man/fegetround.3
new file mode 100644
index 00000000000..1f93010feef
--- /dev/null
+++ b/lib/libm/man/fegetround.3
@@ -0,0 +1,81 @@
+.\" $OpenBSD: fegetround.3,v 1.1 2011/05/25 21:28:43 martynas Exp $
+.\"
+.\" Copyright (c) 2011 Martynas Venckus <martynas@openbsd.org>
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.Dd $Mdocdate: May 25 2011 $
+.Dt FEGETROUND 3
+.Os
+.Sh NAME
+.Nm fegetround ,
+.Nm fesetround
+.Nd control floating-point rounding direction modes
+.Sh SYNOPSIS
+.Fd #include <fenv.h>
+.Ft int
+.Fn fegetround void
+.Ft int
+.Fn fesetround "int round"
+.Sh DESCRIPTION
+These functions provide control of floating-point rounding direction
+modes.
+The
+.Fa round
+input argument is a value specifying a rounding direction mode and
+containing any of the values listed below.
+.Bl -tag -width ".Dv FE_TOWARDZERO"
+.It Dv FE_TONEAREST
+Results are rounded to the closest representable value.
+If the exact result is exactly half way between two representable
+values, the value whose last binary digit is even (zero) is chosen.
+This is the default mode.
+.It Dv FE_DOWNWARD
+Results are rounded towards negative \*[If].
+.It Dv FE_UPWARD
+Results are rounded towards positive \*[If].
+.It Dv FE_TOWARDZERO
+Results are rounded towards zero.
+.El
+.Pp
+The
+.Fn fegetround
+function gets the current rounding direction.
+.Pp
+The
+.Fn fesetround
+function establishes the rounding direction represented by
+.Pa round .
+If the argument is not equal to the value of a rounding direction
+macro, the rounding direction is not changed.
+.Sh RETURN VALUES
+The
+.Fn fegetround
+function returns the current rounding direction.
+The
+.Fn fesetround
+function return zero on success, and non-zero if an error occurred.
+.Sh SEE ALSO
+.Xr feclearexcept 3 ,
+.Xr fegetenv 3 ,
+.Xr feenableexcept 3
+.Sh STANDARDS
+The
+.Fn fegetround ,
+and
+.Fn fesetround
+functions conform to
+.St -isoC-99 .
+.Sh HISTORY
+These functions first appeared in
+.Ox 5.0 .