1llround(3M) Mathematical Library Functions llround(3M)
2
3
4
6 llround, llroundf, llroundl - round to nearest integer value
7
9 c99 [ flag... ] file... -lm [ library... ]
10 #include <math.h>
11
12 long long llround(double x);
13
14
15 long long llroundf(float x);
16
17
18 long long llroundl(long double x);
19
20
22 These functions rounds their argument to the nearest integer value,
23 rounding halfway cases away from 0 regardless of the current rounding
24 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 differ from the llrint(3M) functions in that the
71 default rounding direction for the llround() functions round halfway
72 cases away from 0 and need not raise the inexact floating-point excep‐
73 tion for non-integer arguments that round to within the range of the
74 return type.
75
77 See attributes(5) for descriptions of the following attributes:
78
79
80
81
82 ┌─────────────────────────────┬─────────────────────────────┐
83 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
84 ├─────────────────────────────┼─────────────────────────────┤
85 │Interface Stability │Standard │
86 ├─────────────────────────────┼─────────────────────────────┤
87 │MT-Level │MT-Safe │
88 └─────────────────────────────┴─────────────────────────────┘
89
91 feclearexcept(3M), fetestexcept(3M), llrint(3M), lrint(3M), lround(3M),
92 math.h(3HEAD), attributes(5), standards(5)
93
94
95
96SunOS 5.11 12 Jul 2006 llround(3M)