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

NAME

6       llround, llroundf, llroundl - round to nearest integer value
7

SYNOPSIS

9       #include <math.h>
10
11       long long llround(double x);
12       long long llroundf(float x);
13       long long llroundl(long double x);
14
15

DESCRIPTION

17       These  functions  shall  round  their  argument  to the nearest integer
18       value, rounding halfway cases away from zero, regardless of the current
19       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 differ from the llrint() functions in that the default
71       rounding direction for the llround() functions round halfway cases away
72       from  zero  and need not raise the inexact floating-point exception for
73       non-integer arguments that round to within  the  range  of  the  return
74       type.
75

FUTURE DIRECTIONS

77       None.
78

SEE ALSO

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