libm: Man page updates
[dragonfly.git] / lib / libm / man / lrint.3
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 December 21, 2011
28 .Dt LRINT 3
29 .Os
30 .Sh NAME
31 .Nm llrint ,
32 .Nm llrintf ,
33 .Nm llrintl ,
34 .Nm lrint ,
35 .Nm lrintf ,
36 .Nm lrintl
37 .Nd "convert to integer"
38 .Sh LIBRARY
39 .Lb libm
40 .Sh SYNOPSIS
41 .In math.h
42 .Ft "long long"
43 .Fn llrint "double x"
44 .Ft "long long"
45 .Fn llrintf "float x"
46 .Ft "long long"
47 .Fn llrintl "long double x"
48 .Ft long
49 .Fn lrint "double x"
50 .Ft long
51 .Fn lrintf "float x"
52 .Ft long
53 .Fn lrintl "long double x"
54 .Sh DESCRIPTION
55 The
56 .Fn lrint
57 function returns the integer nearest to its argument
58 .Fa x
59 according to the current rounding mode.
60 If the rounded result is too large to be represented as a
61 .Vt long
62 value, an invalid exception is raised and the return value is undefined.
63 Otherwise, if
64 .Fa x
65 is not an integer,
66 .Fn lrint
67 raises an inexact exception.
68 When the rounded result is representable as a
69 .Vt long ,
70 the expression
71 .Fn lrint x
72 is equivalent to
73 .Po Vt long Pc Ns Fn rint x
74 (although the former may be more efficient).
75 .Pp
76 The
77 .Fn llrint ,
78 .Fn llrintf ,
79 .Fn llrintl ,
80 .Fn lrintf ,
81 and
82 .Fn lrintl
83 functions differ from
84 .Fn lrint
85 only in their input and output types.
86 .Sh SEE ALSO
87 .Xr lround 3 ,
88 .Xr math 3 ,
89 .Xr rint 3 ,
90 .Xr round 3
91 .Sh STANDARDS
92 These functions conform to
93 .St -isoC-99 .
94 .Sh HISTORY
95 The
96 .Fn llrint ,
97 .Fn llrintf ,
98 .Fn lrint ,
99 and
100 .Fn lrintf
101 routines first appeared in
102 .Dx 1.3 .
103 The long double variants were introduced in
104 .Dx 2.13 .