1LLRINT(3P) POSIX Programmer's Manual LLRINT(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 llrint, llrintf, llrintl - round to the nearest integer value using
13 current rounding direction
14
16 #include <math.h>
17
18 long long llrint(double x);
19 long long llrintf(float x);
20 long long llrintl(long double x);
21
22
24 These functions shall round their argument to the nearest integer
25 value, rounding according to the current rounding direction.
26
27 An application wishing to check for error situations should set errno
28 to zero and call feclearexcept(FE_ALL_EXCEPT) before calling these
29 functions. On return, if errno is non-zero or fetestexcept(FE_INVALID
30 | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is non-zero, an error has
31 occurred.
32
34 Upon successful completion, these functions shall return the rounded
35 integer value.
36
37 If x is NaN, a domain error shall occur, and an unspecified value is
38 returned.
39
40 If x is +Inf, a domain error shall occur and an unspecified value is
41 returned.
42
43 If x is -Inf, a domain error shall occur and an unspecified value is
44 returned.
45
46 If the correct value is positive and too large to represent as a long
47 long, a domain error shall occur and an unspecified value is returned.
48
49 If the correct value is negative and too large to represent as a long
50 long, a domain error shall occur and an unspecified value is returned.
51
53 These functions shall fail if:
54
55 Domain Error
56 The x argument is NaN or ±Inf, or the correct value is not rep‐
57 resentable as an integer.
58
59 If the integer expression (math_errhandling & MATH_ERRNO) is non-zero,
60 then errno shall be set to [EDOM]. If the integer expression
61 (math_errhandling & MATH_ERREXCEPT) is non-zero, then the invalid
62 floating-point exception shall be raised.
63
64
65 The following sections are informative.
66
68 None.
69
71 On error, the expressions (math_errhandling & MATH_ERRNO) and
72 (math_errhandling & MATH_ERREXCEPT) are independent of each other, but
73 at least one of them must be non-zero.
74
76 These functions provide floating-to-integer conversions. They round
77 according to the current rounding direction. If the rounded value is
78 outside the range of the return type, the numeric result is unspecified
79 and the invalid floating-point exception is raised. When they raise no
80 other floating-point exception and the result differs from the argu‐
81 ment, they raise the inexact floating-point exception.
82
84 None.
85
87 feclearexcept(), fetestexcept(), lrint(), the Base Definitions volume
88 of IEEE Std 1003.1-2001, Section 4.18, Treatment of Error Conditions
89 for Mathematical Functions, <math.h>
90
92 Portions of this text are reprinted and reproduced in electronic form
93 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
94 -- Portable Operating System Interface (POSIX), The Open Group Base
95 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
96 Electrical and Electronics Engineers, Inc and The Open Group. In the
97 event of any discrepancy between this version and the original IEEE and
98 The Open Group Standard, the original IEEE and The Open Group Standard
99 is the referee document. The original Standard can be obtained online
100 at http://www.opengroup.org/unix/online.html .
101
102
103
104IEEE/The Open Group 2003 LLRINT(3P)