xref: /freebsd/lib/msun/man/lround.3 (revision 7899f917b1c0ea178f1d2be0cfb452086d079d23)
1.\" Copyright (c) 2005 David Schultz <das@FreeBSD.org>
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.Dd April 7, 2005
26.Dt LROUND 3
27.Os
28.Sh NAME
29.Nm llround ,
30.Nm llroundf ,
31.Nm llroundl ,
32.Nm lround ,
33.Nm lroundf ,
34.Nm lroundl
35.Nd "convert to nearest integral value"
36.Sh LIBRARY
37.Lb libm
38.Sh SYNOPSIS
39.In math.h
40.Ft "long long"
41.Fn llround "double x"
42.Ft "long long"
43.Fn llroundf "float x"
44.Ft "long long"
45.Fn llroundl "long double x"
46.Ft long
47.Fn lround "double x"
48.Ft long
49.Fn lroundf "float x"
50.Ft long
51.Fn lroundl "long double x"
52.Sh DESCRIPTION
53The
54.Fn lround
55function returns the integer nearest to its argument
56.Fa x ,
57rounding away from zero in halfway cases.
58If the rounded result is too large to be represented as a
59.Vt long
60value, an invalid exception is raised and the return value is undefined.
61Otherwise, if
62.Fa x
63is not an integer,
64.Fn lround
65may raise an inexact exception.
66When the rounded result is representable as a
67.Vt long ,
68the expression
69.Fn lround x
70is equivalent to
71.Po Vt long Pc Ns Fn round x
72(although the former may be more efficient).
73.Pp
74The
75.Fn llround ,
76.Fn llroundf ,
77.Fn llroundl ,
78.Fn lroundf
79and
80.Fn lroundl
81functions differ from
82.Fn lround
83only in their input and output types.
84.Sh SEE ALSO
85.Xr lrint 3 ,
86.Xr math 3 ,
87.Xr rint 3 ,
88.Xr round 3
89.Sh STANDARDS
90The
91.Fn llround ,
92.Fn llroundf ,
93.Fn llroundl ,
94.Fn lround ,
95.Fn lroundf ,
96and
97.Fn lroundl
98functions conform to
99.St -isoC-99 .
100.Sh HISTORY
101The
102.Vt float
103and
104.Vt double
105versions of these routines first appeared in
106.Fx 5.4 .
107The
108.Vt "long double"
109versions appeared in
110.Fx 6.0 .
111