2009-12-24 21:22:41 +01:00
|
|
|
.TH NEARBYINT 3 "December 18, 2009"
|
|
|
|
.UC 4
|
|
|
|
.SH NAME
|
2009-12-30 21:35:05 +01:00
|
|
|
nearbyint, ceil, floor, trunc \- floating point rounding
|
2009-12-24 21:22:41 +01:00
|
|
|
.SH SYNOPSIS
|
|
|
|
.nf
|
|
|
|
.ft B
|
|
|
|
#include <math.h>
|
|
|
|
|
|
|
|
double ceil(double \fIx\fP);
|
|
|
|
double floor(double \fIx\fP);
|
|
|
|
double nearbyint(double \fIx\fP);
|
|
|
|
double trunc(double \fIx\fP);
|
|
|
|
.fi
|
|
|
|
.SH DESCRIPTION
|
|
|
|
These functions round the specified floating point number to a nearby integer.
|
|
|
|
For nearbyint, the rounding mode is determined by the value set using the
|
|
|
|
fesetround function. The other functions are not influenced by the rounding
|
|
|
|
mode. The ceil function rounds upwards, selecting the smallest integer that is
|
|
|
|
larger than or equal to \fIx\fP. The floor function rounds downwards, selecting
|
|
|
|
the largest integer that is smaller than or equal to \fIx\fP. The trunc function
|
|
|
|
rounds towards zero, selecting the largest integer with the largest absolute
|
|
|
|
value of which the absolute value is smaller than or equal to the absolute
|
|
|
|
value of \fIx\fP.
|
|
|
|
.SH "RETURN VALUE"
|
|
|
|
The functions return an integer close to \fIx\fP.
|
|
|
|
.SH "SEE ALSO"
|
|
|
|
fesetround(3)
|