1llrint(3M) Mathematical Library Functions llrint(3M)
2
3
4
6 llrint, llrintf, llrintl - round to nearest integer value using current
7 rounding direction
8
10 c99 [ flag... ] file... -lm [ library... ]
11 #include <math.h>
12
13 long long llrint(double x);
14
15
16 long long llrintf(float x);
17
18
19 long long llrintl(long double x);
20
21
23 These functions round their argument to the nearest integer value,
24 rounding according to the current rounding direction.
25
27 Upon successful completion, these functions return the rounded integer
28 value.
29
30
31 If x is NaN, a domain error occurs and an unspecified value is
32 returned.
33
34
35 If x is +Inf, a domain error occurs and an unspecified value is
36 returned.
37
38
39 If x is -Inf, a domain error occurs and an unspecified value is
40 returned.
41
42
43 If the correct value is positive and too large to represent as a long
44 long, a domain error occurs and an unspecified value is returned.
45
46
47 If the correct value is negative and too large to represent as a long
48 long, a domain error occurs and an unspecified value is returned.
49
51 These functions will fail if:
52
53 Domain Error The x argument is NaN or ±Inf, or the correct value is
54 not representable as an integer.
55
56 If the integer expression (math_errhandling &
57 MATH_ERREXCEPT) is non-zero, then the invalid floating-
58 point exception will be raised.
59
60
62 An application wanting to check for exceptions should call feclearex‐
63 cept(FE_ALL_EXCEPT) before calling these functions. On return, if
64 fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is
65 non-zero, an exception has been raised. An application should either
66 examine the return value or check the floating point exception flags to
67 detect exceptions.
68
69
70 These functions provide floating-to-integer conversions. They round
71 according to the current rounding direction. If the rounded value is
72 outside the range of the return type, the numeric result is unspecified
73 and the invalid floating-point exception is raised. When they raise no
74 other floating-point exception and the result differs from the argu‐
75 ment, they raise the inexact floating-point exception.
76
78 See attributes(5) for descriptions of the following attributes:
79
80
81
82
83 ┌─────────────────────────────┬─────────────────────────────┐
84 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
85 ├─────────────────────────────┼─────────────────────────────┤
86 │Interface Stability │Standard │
87 ├─────────────────────────────┼─────────────────────────────┤
88 │MT-Level │MT-Safe │
89 └─────────────────────────────┴─────────────────────────────┘
90
92 feclearexcept(3M), fetestexcept(3M), lrint(3M), math.h(3HEAD),
93 attributes(5), standards(5)
94
95
96
97SunOS 5.11 12 Jul 2006 llrint(3M)