1LLRINT(P)                  POSIX Programmer's Manual                 LLRINT(P)
2
3
4

NAME

6       llrint,  llrintf,  llrintl  -  round to the nearest integer value using
7       current rounding direction
8

SYNOPSIS

10       #include <math.h>
11
12       long long llrint(double x);
13       long long llrintf(float x);
14       long long llrintl(long double x);
15
16

DESCRIPTION

18       These functions shall round  their  argument  to  the  nearest  integer
19       value, rounding according to the current rounding direction.
20
21       An  application  wishing to check for error situations should set errno
22       to zero and  call  feclearexcept(FE_ALL_EXCEPT)  before  calling  these
23       functions.   On return, if errno is non-zero or fetestexcept(FE_INVALID
24       | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is non-zero, an error  has
25       occurred.
26

RETURN VALUE

28       Upon  successful  completion,  these functions shall return the rounded
29       integer value.
30
31       If x is NaN, a domain error shall occur, and an  unspecified  value  is
32       returned.
33
34       If  x  is  +Inf, a domain error shall occur and an unspecified value is
35       returned.
36
37       If x is -Inf, a domain error shall occur and an  unspecified  value  is
38       returned.
39
40       If  the  correct value is positive and too large to represent as a long
41       long, a domain error shall occur and an unspecified value is returned.
42
43       If the correct value is negative and too large to represent as  a  long
44       long, a domain error shall occur and an unspecified value is returned.
45

ERRORS

47       These functions shall fail if:
48
49       Domain Error
50              The  x argument is NaN or ±Inf, or the correct value is not rep‐
51              resentable as an integer.
52
53       If the integer expression (math_errhandling & MATH_ERRNO) is  non-zero,
54       then   errno  shall  be  set  to  [EDOM].  If  the  integer  expression
55       (math_errhandling &  MATH_ERREXCEPT)  is  non-zero,  then  the  invalid
56       floating-point exception shall be raised.
57
58
59       The following sections are informative.
60

EXAMPLES

62       None.
63

APPLICATION USAGE

65       On   error,   the   expressions  (math_errhandling  &  MATH_ERRNO)  and
66       (math_errhandling & MATH_ERREXCEPT) are independent of each other,  but
67       at least one of them must be non-zero.
68

RATIONALE

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

FUTURE DIRECTIONS

78       None.
79

SEE ALSO

81       feclearexcept() , fetestexcept() , lrint() , the Base Definitions  vol‐
82       ume  of  IEEE Std 1003.1-2001,  Section 4.18, Treatment of Error Condi‐
83       tions for Mathematical Functions, <math.h>
84
86       Portions of this text are reprinted and reproduced in  electronic  form
87       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
88       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
89       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
90       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
91       event of any discrepancy between this version and the original IEEE and
92       The Open Group Standard, the original IEEE and The Open Group  Standard
93       is  the  referee document. The original Standard can be obtained online
94       at http://www.opengroup.org/unix/online.html .
95
96
97
98IEEE/The Open Group                  2003                            LLRINT(P)
Impressum