xref: /dflybsd-src/contrib/openbsd_libm/man/lround.3 (revision 4382f29d99a100bd77a81697c2f699c11f6a472a)
1*05a0b428SJohn Marino.\" 	$OpenBSD: lround.3,v 1.5 2013/08/14 06:32:29 jmc Exp $
2*05a0b428SJohn Marino.\"
3*05a0b428SJohn Marino.\" Copyright (c) 2005 David Schultz <das@FreeBSD.org>
4*05a0b428SJohn Marino.\" All rights reserved.
5*05a0b428SJohn Marino.\"
6*05a0b428SJohn Marino.\" Redistribution and use in source and binary forms, with or without
7*05a0b428SJohn Marino.\" modification, are permitted provided that the following conditions
8*05a0b428SJohn Marino.\" are met:
9*05a0b428SJohn Marino.\" 1. Redistributions of source code must retain the above copyright
10*05a0b428SJohn Marino.\"    notice, this list of conditions and the following disclaimer.
11*05a0b428SJohn Marino.\" 2. Redistributions in binary form must reproduce the above copyright
12*05a0b428SJohn Marino.\"    notice, this list of conditions and the following disclaimer in the
13*05a0b428SJohn Marino.\"    documentation and/or other materials provided with the distribution.
14*05a0b428SJohn Marino.\"
15*05a0b428SJohn Marino.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16*05a0b428SJohn Marino.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17*05a0b428SJohn Marino.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18*05a0b428SJohn Marino.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19*05a0b428SJohn Marino.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20*05a0b428SJohn Marino.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21*05a0b428SJohn Marino.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22*05a0b428SJohn Marino.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23*05a0b428SJohn Marino.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24*05a0b428SJohn Marino.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25*05a0b428SJohn Marino.\" SUCH DAMAGE.
26*05a0b428SJohn Marino.\"
27*05a0b428SJohn Marino.\" $FreeBSD: /repoman/r/ncvs/src/lib/msun/man/lround.3,v 1.4 2005/06/15 19:04:04 ru Exp $
28*05a0b428SJohn Marino.\"
29*05a0b428SJohn Marino.Dd $Mdocdate: August 14 2013 $
30*05a0b428SJohn Marino.Dt LROUND 3
31*05a0b428SJohn Marino.Os
32*05a0b428SJohn Marino.Sh NAME
33*05a0b428SJohn Marino.Nm llround ,
34*05a0b428SJohn Marino.Nm llroundf ,
35*05a0b428SJohn Marino.Nm llroundl ,
36*05a0b428SJohn Marino.Nm lround ,
37*05a0b428SJohn Marino.Nm lroundf ,
38*05a0b428SJohn Marino.Nm lroundl
39*05a0b428SJohn Marino.Nd convert to nearest integral value
40*05a0b428SJohn Marino.Sh SYNOPSIS
41*05a0b428SJohn Marino.In math.h
42*05a0b428SJohn Marino.Ft "long long"
43*05a0b428SJohn Marino.Fn llround "double x"
44*05a0b428SJohn Marino.Ft "long long"
45*05a0b428SJohn Marino.Fn llroundf "float x"
46*05a0b428SJohn Marino.Ft "long long"
47*05a0b428SJohn Marino.Fn llroundl "long double x"
48*05a0b428SJohn Marino.Ft long
49*05a0b428SJohn Marino.Fn lround "double x"
50*05a0b428SJohn Marino.Ft long
51*05a0b428SJohn Marino.Fn lroundf "float x"
52*05a0b428SJohn Marino.Ft long
53*05a0b428SJohn Marino.Fn lroundl "long double x"
54*05a0b428SJohn Marino.Sh DESCRIPTION
55*05a0b428SJohn MarinoThe
56*05a0b428SJohn Marino.Fn lround
57*05a0b428SJohn Marinofunction returns the integer nearest to its argument
58*05a0b428SJohn Marino.Fa x ,
59*05a0b428SJohn Marinorounding away from zero in halfway cases.
60*05a0b428SJohn MarinoIf the rounded result is too large to be represented as a
61*05a0b428SJohn Marino.Vt long
62*05a0b428SJohn Marinovalue, an invalid exception is raised and the return value is undefined.
63*05a0b428SJohn MarinoOtherwise, if
64*05a0b428SJohn Marino.Fa x
65*05a0b428SJohn Marinois not an integer,
66*05a0b428SJohn Marino.Fn lround
67*05a0b428SJohn Marinomay raise an inexact exception.
68*05a0b428SJohn MarinoWhen the rounded result is representable as a
69*05a0b428SJohn Marino.Vt long ,
70*05a0b428SJohn Marinothe expression
71*05a0b428SJohn Marino.Fn lround x
72*05a0b428SJohn Marinois equivalent to
73*05a0b428SJohn Marino.Po Vt long Pc Ns Fn round x
74*05a0b428SJohn Marino(although the former may be more efficient).
75*05a0b428SJohn Marino.Pp
76*05a0b428SJohn MarinoThe
77*05a0b428SJohn Marino.Fn llround ,
78*05a0b428SJohn Marino.Fn llroundf ,
79*05a0b428SJohn Marino.Fn llroundl ,
80*05a0b428SJohn Marino.Fn lroundf
81*05a0b428SJohn Marinoand
82*05a0b428SJohn Marino.Fn lroundl
83*05a0b428SJohn Marinofunctions differ from
84*05a0b428SJohn Marino.Fn lround
85*05a0b428SJohn Marinoonly in their input and output types.
86*05a0b428SJohn Marino.Sh SEE ALSO
87*05a0b428SJohn Marino.Xr lrint 3 ,
88*05a0b428SJohn Marino.Xr rint 3
89*05a0b428SJohn Marino.Sh STANDARDS
90*05a0b428SJohn MarinoThe
91*05a0b428SJohn Marino.Fn llround ,
92*05a0b428SJohn Marino.Fn llroundf ,
93*05a0b428SJohn Marino.Fn llroundl ,
94*05a0b428SJohn Marino.Fn lround ,
95*05a0b428SJohn Marino.Fn lroundf ,
96*05a0b428SJohn Marinoand
97*05a0b428SJohn Marino.Fn lroundl
98*05a0b428SJohn Marinofunctions conform to
99*05a0b428SJohn Marino.St -isoC-99 .
100