1LLROUND(3P)                POSIX Programmer's Manual               LLROUND(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

NAME

12       llround, llroundf, llroundl - round to nearest integer value
13

SYNOPSIS

15       #include <math.h>
16
17       long long llround(double x);
18       long long llroundf(float x);
19       long long llroundl(long double x);
20
21

DESCRIPTION

23       These functions shall round  their  argument  to  the  nearest  integer
24       value, rounding halfway cases away from zero, regardless of the current
25       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

RETURN VALUE

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

ERRORS

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

EXAMPLES

68       None.
69

APPLICATION USAGE

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

RATIONALE

76       These functions differ from the llrint() functions in that the  default
77       rounding direction for the llround() functions round halfway cases away
78       from zero and need not raise the inexact floating-point  exception  for
79       non-integer  arguments  that  round  to  within the range of the return
80       type.
81

FUTURE DIRECTIONS

83       None.
84

SEE ALSO

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