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

NAME

6       lround,  lroundf, lroundl, llround, llroundf, llroundl - round to near‐
7       est integer
8

SYNOPSIS

10       #include <math.h>
11
12       long lround(double x);
13       long lroundf(float x);
14       long lroundl(long double x);
15
16       long long llround(double x);
17       long long llroundf(float x);
18       long long 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           _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
26

DESCRIPTION

28       These functions round their argument  to  the  nearest  integer  value,
29       rounding halfway cases away from zero, regardless of the current round‐
30       ing direction (see fenv(3)).
31
32       Note that unlike the round(3) and ceil(3), functions, the  return  type
33       of these functions differs from that of their arguments.
34

RETURN VALUE

36       These functions return the rounded integer value.
37
38       If  x  is a NaN or an infinity, or the rounded value is too large to be
39       stored in a long (long long in the case of the ll* functions),  then  a
40       domain error occurs, and the return value is unspecified.
41

ERRORS

43       See  math_error(7) for information on how to determine whether an error
44       has occurred when calling these functions.
45
46       The following errors can occur:
47
48       Domain error: x is a NaN or infinite, or the rounded value is too large
49              An invalid floating-point exception (FE_INVALID) is raised.
50
51       These functions do not set errno.
52

VERSIONS

54       These functions first appeared in glibc in version 2.1.
55

ATTRIBUTES

57       For an  explanation  of  the  terms  used  in  this  section,  see  at‐
58       tributes(7).
59
60       ┌────────────────────────────────────────────┬───────────────┬─────────┐
61Interface                                   Attribute     Value   
62       ├────────────────────────────────────────────┼───────────────┼─────────┤
63lround(), lroundf(), lroundl(), llround(),  │ Thread safety │ MT-Safe │
64llroundf(), llroundl()                      │               │         │
65       └────────────────────────────────────────────┴───────────────┴─────────┘
66

CONFORMING TO

68       C99, POSIX.1-2001, POSIX.1-2008.
69

SEE ALSO

71       ceil(3), floor(3), lrint(3), nearbyint(3), rint(3), round(3)
72

COLOPHON

74       This page is part of release 5.12 of the Linux  man-pages  project.   A
75       description  of  the project, information about reporting bugs, and the
76       latest    version    of    this    page,    can     be     found     at
77       https://www.kernel.org/doc/man-pages/.
78
79
80
81                                  2021-03-22                         LROUND(3)
Impressum