minix/man/man3/fesetround.3
2009-12-30 20:35:05 +00:00

35 lines
1.4 KiB
Groff

.TH FESETROUND 3 "December 18, 2009"
.UC 4
.SH NAME
fesetround, fegetround \- floating point rounding mode control
.SH SYNOPSIS
.nf
.ft B
#include <fenv.h>
int fegetround(void);
int fesetround(int \fIround\fP);
.fi
.SH DESCRIPTION
These functions control the floating point rounding mode. One can use
fegetround to determine the rounding mode currently in effect and fesetround
the change the rounding mode. Four rounding modes are recognized: FE_TONEAREST,
FE_DOWNWARD, FE_UPWARD and FE_TOWARDZERO. When rounding a value \fIx\fP to an
integer \fIn\fP, the following approaches can be taken: FE_TONEAREST selects
the \fIn\fP for which abs(fIx\fP - \fIn\fP) is minimal, preferring an even
\fIn\fP if there are two possibilities; FE_DOWNWARD selects the largest \fIn\fP
for which \fIn\fP <= fIx\fP; FE_UPWARD selects the smallest \fIn\fP for which
\fIn\fP >= fIx\fP; and FE_TOWARDZERO selects \fIn\fP with the largest
abs(\fIn\fP) for which abs(\fIn\fP) <= abs(\fIx\fP).
.SH "RETURN VALUE"
fegetround returns the current rounding mode. fesetround returns 0 if it was
succesful in adjusting the rounding mode and -1 otherwise. The only possible
reason for failure is an unsupported value for \fIround\fP, which is signalled
by setting errno to EINVAL.
.SH DIAGNOSTICS
fegetround always succeeds. The only possible reason for failure of fesetround
is an unsupported value for \fIround\fP, which is signalled by setting errno to
EINVAL.
.SH "SEE ALSO"
nearbyint(3)