1RINT(3)                    Linux Programmer's Manual                   RINT(3)
2
3
4

NAME

6       nearbyint,  nearbyintf, nearbyintl, rint, rintf, rintl - round to near‐
7       est integer
8

SYNOPSIS

10       #include <math.h>
11
12       double nearbyint(double x);
13       float nearbyintf(float x);
14       long double nearbyintl(long double x);
15
16       double rint(double x);
17       float rintf(float x);
18       long double rintl(long double x);
19
20       Link with -lm.
21

DESCRIPTION

23       The nearbyint() functions round their argument to an integer  value  in
24       floating point format, using the current rounding direction and without
25       raising the inexact exception.
26
27       The rint() functions do the same, but will raise the inexact  exception
28       when the result differs in value from the argument.
29

RETURN VALUE

31       The  rounded  integer  value. If x is integral or infinite, x itself is
32       returned.
33

ERRORS

35       No errors other than EDOM and ERANGE can occur.  If x is NaN, then  NaN
36       is returned and errno may be set to EDOM.
37

NOTES

39       SUSv2  and  POSIX.1-2001  contain  text about overflow (which might set
40       errno to ERANGE, or raise an exception).  In practice, the result  can‐
41       not  overflow  on  any current machine, so this error-handling stuff is
42       just nonsense.  (More precisely, overflow can happen only when the max‐
43       imum value of the exponent is smaller than the number of mantissa bits.
44       For the IEEE-754 standard 32-bit and 64-bit floating point numbers  the
45       maximum  value  of  the exponent is 128 (resp. 1024), and the number of
46       mantissa bits is 24 (resp. 53).)
47

CONFORMING TO

49       C99.
50

SEE ALSO

52       ceil(3), floor(3), lrint(3), nearbyint(3), round(3), trunc(3)
53
54
55
56                                  2001-05-31                           RINT(3)
Impressum