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

NAME

6       lrint,  lrintf, lrintl, llrint, llrintf, llrintl - round to nearest in‐
7       teger
8

LIBRARY

10       Math library (libm, -lm)
11

SYNOPSIS

13       #include <math.h>
14
15       long lrint(double x);
16       long lrintf(float x);
17       long lrintl(long double x);
18
19       long long llrint(double x);
20       long long llrintf(float x);
21       long long llrintl(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,  us‐
30       ing the current rounding direction (see fesetround(3)).
31
32       Note  that  unlike  the rint(3) family of functions, the return type of
33       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

ATTRIBUTES

54       For  an  explanation  of  the  terms  used  in  this  section,  see at‐
55       tributes(7).
56
57       ┌────────────────────────────────────────────┬───────────────┬─────────┐
58Interface                                   Attribute     Value   
59       ├────────────────────────────────────────────┼───────────────┼─────────┤
60lrint(), lrintf(), lrintl(), llrint(),      │ Thread safety │ MT-Safe │
61llrintf(), llrintl()                        │               │         │
62       └────────────────────────────────────────────┴───────────────┴─────────┘
63

STANDARDS

65       C11, POSIX.1-2008.
66

HISTORY

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

SEE ALSO

71       ceil(3), floor(3), lround(3), nearbyint(3), rint(3), round(3)
72
73
74
75Linux man-pages 6.05              2023-07-20                          lrint(3)
Impressum