1LROUND(3) Linux Programmer's Manual LROUND(3)
2
3
4
6 lround, lroundf, lroundl, llround, llroundf, llroundl - round to near‐
7 est integer, away from zero
8
10 #include <math.h>
11
12 long int lround(double x);
13 long int lroundf(float x);
14 long int lroundl(long double x);
15
16 long long int llround(double x);
17 long long int llroundf(float x);
18 long long int llroundl(long double x);
19
20 Link with -lm.
21
22 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
23
24 All functions shown above:
25 _XOPEN_SOURCE >= 600 || _ISOC99_SOURCE ||
26 _POSIX_C_SOURCE >= 200112L;
27 or cc -std=c99
28
30 These functions round their argument to the nearest integer value,
31 rounding away from zero, regardless of the current rounding direction
32 (see fenv(3)).
33
34 Note that unlike round(3), ceil(3), etc., the return type of these
35 functions differs from that of their arguments.
36
38 These functions return the rounded integer value.
39
40 If x is a NaN or an infinity, or the rounded value is too large to be
41 stored in a long (long long in the case of the ll* functions) then a
42 domain error occurs, and the return value is unspecified.
43
45 See math_error(7) for information on how to determine whether an error
46 has occurred when calling these functions.
47
48 The following errors can occur:
49
50 Domain error: x is a NaN or infinite, or the rounded value is too large
51 An invalid floating-point exception (FE_INVALID) is raised.
52
53 These functions do not set errno.
54
56 These functions first appeared in glibc in version 2.1.
57
59 C99, POSIX.1-2001.
60
62 ceil(3), floor(3), lrint(3), nearbyint(3), rint(3), round(3)
63
65 This page is part of release 3.53 of the Linux man-pages project. A
66 description of the project, and information about reporting bugs, can
67 be found at http://www.kernel.org/doc/man-pages/.
68
69
70
71 2010-09-20 LROUND(3)