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

PROLOG

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
11

NAME

13       llrint, llrintf, llrintl — round to the  nearest  integer  value  using
14       current rounding direction
15

SYNOPSIS

17       #include <math.h>
18
19       long long llrint(double x);
20       long long llrintf(float x);
21       long long llrintl(long double x);
22

DESCRIPTION

24       The  functionality described on this reference page is aligned with the
25       ISO C standard. Any conflict between the  requirements  described  here
26       and  the  ISO C  standard is unintentional. This volume of POSIX.1‐2008
27       defers to the ISO C standard.
28
29       These functions shall round  their  argument  to  the  nearest  integer
30       value, rounding according to the current rounding direction.
31
32       An  application  wishing to check for error situations should set errno
33       to zero and  call  feclearexcept(FE_ALL_EXCEPT)  before  calling  these
34       functions. On return, if errno is non-zero or fetestexcept(FE_INVALID |
35       FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is non-zero,  an  error  has
36       occurred.
37

RETURN VALUE

39       Upon  successful  completion,  these functions shall return the rounded
40       integer value.
41
42       If x is NaN, a domain error shall occur, and an  unspecified  value  is
43       returned.
44
45       If  x  is  +Inf, a domain error shall occur and an unspecified value is
46       returned.
47
48       If x is −Inf, a domain error shall occur and an  unspecified  value  is
49       returned.
50
51       If  the  correct value is positive and too large to represent as a long
52       long, an unspecified value shall be returned.  On systems that  support
53       the IEC 60559 Floating-Point option, a domain error shall occur; other‐
54       wise, a domain error may occur.
55
56       If the correct value is negative and too large to represent as  a  long
57       long,  an unspecified value shall be returned.  On systems that support
58       the IEC 60559 Floating-Point option, a domain error shall occur; other‐
59       wise, a domain error may occur.
60

ERRORS

62       These functions shall fail if:
63
64       Domain Error
65                   The  x argument is NaN or ±Inf, or the correct value is not
66                   representable as an integer.
67
68                   If the integer expression (math_errhandling  &  MATH_ERRNO)
69                   is  non-zero,  then  errno  shall be set to [EDOM].  If the
70                   integer expression (math_errhandling &  MATH_ERREXCEPT)  is
71                   non-zero,  then  the invalid floating-point exception shall
72                   be raised.
73
74       These functions may fail if:
75
76       Domain Error
77                   The correct value is not representable as an integer.
78
79                   If the integer expression (math_errhandling  &  MATH_ERRNO)
80                   is  non-zero,  then  errno  shall be set to [EDOM].  If the
81                   integer expression (math_errhandling &  MATH_ERREXCEPT)  is
82                   non-zero,  then  the invalid floating-point exception shall
83                   be raised.
84
85       The following sections are informative.
86

EXAMPLES

88       None.
89

APPLICATION USAGE

91       On  error,  the  expressions  (math_errhandling   &   MATH_ERRNO)   and
92       (math_errhandling  & MATH_ERREXCEPT) are independent of each other, but
93       at least one of them must be non-zero.
94

RATIONALE

96       These functions provide  floating-to-integer  conversions.  They  round
97       according  to  the  current rounding direction. If the rounded value is
98       outside the range of the return type, the numeric result is unspecified
99       and  the invalid floating-point exception is raised. When they raise no
100       other floating-point exception and the result differs  from  the  argu‐
101       ment, they raise the inexact floating-point exception.
102

FUTURE DIRECTIONS

104       None.
105

SEE ALSO

107       feclearexcept(), fetestexcept(), lrint()
108
109       The Base Definitions volume of POSIX.1‐2008, Section 4.19, Treatment of
110       Error Conditions for Mathematical Functions, <math.h>
111
113       Portions of this text are reprinted and reproduced in  electronic  form
114       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
115       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
116       Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
117       cal and Electronics Engineers,  Inc  and  The  Open  Group.   (This  is
118       POSIX.1-2008  with  the  2013  Technical Corrigendum 1 applied.) In the
119       event of any discrepancy between this version and the original IEEE and
120       The  Open Group Standard, the original IEEE and The Open Group Standard
121       is the referee document. The original Standard can be  obtained  online
122       at http://www.unix.org/online.html .
123
124       Any  typographical  or  formatting  errors that appear in this page are
125       most likely to have been introduced during the conversion of the source
126       files  to  man page format. To report such errors, see https://www.ker
127       nel.org/doc/man-pages/reporting_bugs.html .
128
129
130
131IEEE/The Open Group                  2013                           LLRINT(3P)
Impressum