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