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