1lround(3)                  Library Functions Manual                  lround(3)
2
3
4

NAME

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

LIBRARY

10       Math library (libm, -lm)
11

SYNOPSIS

13       #include <math.h>
14
15       long lround(double x);
16       long lroundf(float x);
17       long lroundl(long double x);
18
19       long long llround(double x);
20       long long llroundf(float x);
21       long long llroundl(long double x);
22
23   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
24
25       All functions shown above:
26           _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
27

DESCRIPTION

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

RETURN VALUE

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

ERRORS

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

ATTRIBUTES

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

STANDARDS

66       C11, POSIX.1-2008.
67

HISTORY

69       glibc 2.1.  C99, POSIX.1-2001.
70

SEE ALSO

72       ceil(3), floor(3), lrint(3), nearbyint(3), rint(3), round(3)
73
74
75
76Linux man-pages 6.04              2023-03-30                         lround(3)
Impressum