xref: /openbsd-src/lib/libm/man/lround.3 (revision 2b0358df1d88d06ef4139321dd05bd5e05d91eaf)
1.\" 	$OpenBSD: lround.3,v 1.2 2007/05/31 19:19:36 jmc Exp $
2.\"
3.\" Copyright (c) 2005 David Schultz <das@FreeBSD.org>
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25.\" SUCH DAMAGE.
26.\"
27.\" $FreeBSD: /repoman/r/ncvs/src/lib/msun/man/lround.3,v 1.4 2005/06/15 19:04:04 ru Exp $
28.\"
29.Dd $Mdocdate: May 31 2007 $
30.Dt LROUND 3
31.Os
32.Sh NAME
33.Nm llround ,
34.Nm llroundf ,
35.\" .Nm llroundl ,
36.Nm lround ,
37.Nm lroundf
38.\" .Nm lroundl
39.Nd "convert to nearest integral value"
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 lroundl
81and
82.Fn lroundf
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.Sh STANDARDS
91The
92.Fn llround ,
93.Fn llroundf ,
94.\" .Fn lroundl
95.\" .Fn llroundl ,
96.Fn lround ,
97and
98.Fn lroundf
99functions conform to
100.St -isoC-99 .
101