xref: /freebsd/lib/msun/man/lround.3 (revision af23369a6deaaeb612ab266eb88b8bb8d560c322)
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.\" $FreeBSD$
26.\"
27.Dd April 7, 2005
28.Dt LROUND 3
29.Os
30.Sh NAME
31.Nm llround ,
32.Nm llroundf ,
33.Nm llroundl ,
34.Nm lround ,
35.Nm lroundf ,
36.Nm lroundl
37.Nd "convert to nearest integral value"
38.Sh LIBRARY
39.Lb libm
40.Sh SYNOPSIS
41.In math.h
42.Ft "long long"
43.Fn llround "double x"
44.Ft "long long"
45.Fn llroundf "float x"
46.Ft "long long"
47.Fn llroundl "long double x"
48.Ft long
49.Fn lround "double x"
50.Ft long
51.Fn lroundf "float x"
52.Ft long
53.Fn lroundl "long double x"
54.Sh DESCRIPTION
55The
56.Fn lround
57function returns the integer nearest to its argument
58.Fa x ,
59rounding away from zero in halfway cases.
60If the rounded result is too large to be represented as a
61.Vt long
62value, an invalid exception is raised and the return value is undefined.
63Otherwise, if
64.Fa x
65is not an integer,
66.Fn lround
67may raise an inexact exception.
68When the rounded result is representable as a
69.Vt long ,
70the expression
71.Fn lround x
72is equivalent to
73.Po Vt long Pc Ns Fn round x
74(although the former may be more efficient).
75.Pp
76The
77.Fn llround ,
78.Fn llroundf ,
79.Fn llroundl ,
80.Fn lroundf
81and
82.Fn lroundl
83functions differ from
84.Fn lround
85only in their input and output types.
86.Sh SEE ALSO
87.Xr lrint 3 ,
88.Xr math 3 ,
89.Xr rint 3 ,
90.Xr round 3
91.Sh STANDARDS
92The
93.Fn llround ,
94.Fn llroundf ,
95.Fn llroundl ,
96.Fn lround ,
97.Fn lroundf ,
98and
99.Fn lroundl
100functions conform to
101.St -isoC-99 .
102.Sh HISTORY
103The
104.Vt float
105and
106.Vt double
107versions of these routines first appeared in
108.Fx 5.4 .
109The
110.Vt "long double"
111versions appeared in
112.Fx 6.0 .
113