xref: /openbsd-src/lib/libm/man/lrint.3 (revision 43003dfe3ad45d1698bed8a37f2b0f5b14f20d4f)
1.\" 	$OpenBSD: lrint.3,v 1.2 2007/05/31 19:19:35 jmc Exp $
2.\" $NetBSD: lrint.3,v 1.1 2005/09/16 15:26:47 wiz Exp $
3.\"
4.\" Copyright (c) 2005 David Schultz <das@FreeBSD.org>
5.\" All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.\" $FreeBSD: /repoman/r/ncvs/src/lib/msun/man/lrint.3,v 1.2.2.2 2005/03/01 16:18:39 brueffer Exp $
29.\"
30.Dd $Mdocdate: May 31 2007 $
31.Dt LRINT 3
32.Os
33.Sh NAME
34.Nm llrint ,
35.Nm llrintf ,
36.Nm lrint ,
37.Nm lrintf
38.Nd convert to integer
39.Sh SYNOPSIS
40.In math.h
41.Ft long long
42.Fn llrint "double x"
43.Ft long long
44.Fn llrintf "float x"
45.Ft long
46.Fn lrint "double x"
47.Ft long
48.Fn lrintf "float x"
49.Sh DESCRIPTION
50The
51.Fn lrint
52function returns the integer nearest to its argument
53.Fa x
54according to the current rounding mode.
55.Pp
56The
57.Fn llrint ,
58.Fn llrintf ,
59and
60.Fn lrintf
61functions differ from
62.Fn lrint
63only in their input and output types.
64.Sh RETURN VALUES
65The
66.Nm llrint ,
67.Nm llrintf ,
68.Nm lrint ,
69and
70.Nm lrintf
71functions return the integer nearest to their argument
72.Fa x
73according to the current rounding mode.
74If the rounded result is too large to be represented as a
75.Vt long long
76or
77.Vt long
78value, respectively,
79.\" an invalid exception is raised and
80the return value is undefined.
81.\" Otherwise, if
82.\" .Fa x
83.\" is not an integer,
84.\" .Fn lrint
85.\" raises an inexact exception.
86.\" If
87.\" .Fa x
88.\" is too large, a range error may occur.
89.Sh SEE ALSO
90.Xr lround 3 ,
91.Xr math 3 ,
92.Xr rint 3
93.Sh STANDARDS
94The
95.Fn llrint ,
96.Fn llrintf ,
97.Fn lrint ,
98and
99.Fn lrintf
100functions conform to
101.St -isoC-99 .
102