1lround(3M)              Mathematical Library Functions              lround(3M)
2
3
4

NAME

6       lround, lroundf, lroundl - round to nearest integer value
7

SYNOPSIS

9       c99 [ flag... ] file... -lm [ library... ]
10       #include <math.h>
11
12       long lround(double x);
13
14
15       long lroundf(float x);
16
17
18       long lroundl(long double x);
19
20

DESCRIPTION

22       These  functions  round  their  argument  to the nearest integer value,
23       rounding halfway cases away from zero, regardless of the current round‐
24       ing direction.
25

RETURN VALUES

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

ERRORS

51       These functions will fail if:
52
53       Domain Error    The  x argument is NaN or ±Inf, or the correct value is
54                       not representable as an integer.
55
56                       If   the   integer   expression   (math_errhandling   &
57                       MATH_ERREXCEPT) is non-zero, then the invalid floating-
58                       point exception is raised.
59
60

USAGE

62       An application wanting to check for exceptions should  call  feclearex‐
63       cept(FE_ALL_EXCEPT)  before  calling  these  functions.  On  return, if
64       fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is
65       non-zero,  an  exception  has been raised. An application should either
66       examine the return value or check the floating point exception flags to
67       detect exceptions.
68

ATTRIBUTES

70       See attributes(5) for descriptions of the following attributes:
71
72
73
74
75       ┌─────────────────────────────┬─────────────────────────────┐
76       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
77       ├─────────────────────────────┼─────────────────────────────┤
78       │Interface Stability          │Standard                     │
79       ├─────────────────────────────┼─────────────────────────────┤
80       │MT-Level                     │MT-Safe                      │
81       └─────────────────────────────┴─────────────────────────────┘
82

SEE ALSO

84       feclearexcept(3M),    fetestexcept(3M),   llround(3M),   math.h(3HEAD),
85       attributes(5), standards(5)
86
87
88
89SunOS 5.11                        12 Jul 2006                       lround(3M)
Impressum