1*05a0b428SJohn Marino.\" $OpenBSD: round.3,v 1.5 2011/07/07 01:34:52 martynas Exp $ 2*05a0b428SJohn Marino.\" Copyright (c) 2003, Steven G. Kargl 3*05a0b428SJohn Marino.\" All rights reserved. 4*05a0b428SJohn Marino.\" 5*05a0b428SJohn Marino.\" Redistribution and use in source and binary forms, with or without 6*05a0b428SJohn Marino.\" modification, are permitted provided that the following conditions 7*05a0b428SJohn Marino.\" are met: 8*05a0b428SJohn Marino.\" 1. Redistributions of source code must retain the above copyright 9*05a0b428SJohn Marino.\" notice, this list of conditions and the following disclaimer. 10*05a0b428SJohn Marino.\" 2. Redistributions in binary form must reproduce the above copyright 11*05a0b428SJohn Marino.\" notice, this list of conditions and the following disclaimer in the 12*05a0b428SJohn Marino.\" documentation and/or other materials provided with the distribution. 13*05a0b428SJohn Marino.\" 14*05a0b428SJohn Marino.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 15*05a0b428SJohn Marino.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16*05a0b428SJohn Marino.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17*05a0b428SJohn Marino.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 18*05a0b428SJohn Marino.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19*05a0b428SJohn Marino.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20*05a0b428SJohn Marino.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21*05a0b428SJohn Marino.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22*05a0b428SJohn Marino.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23*05a0b428SJohn Marino.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24*05a0b428SJohn Marino.\" SUCH DAMAGE. 25*05a0b428SJohn Marino.\" 26*05a0b428SJohn Marino.\" $FreeBSD: src/lib/msun/man/round.3,v 1.6 2005/06/15 19:04:04 ru Exp $ 27*05a0b428SJohn Marino.\" 28*05a0b428SJohn Marino.Dd $Mdocdate: July 7 2011 $ 29*05a0b428SJohn Marino.Dt ROUND 3 30*05a0b428SJohn Marino.Os 31*05a0b428SJohn Marino.Sh NAME 32*05a0b428SJohn Marino.Nm round , 33*05a0b428SJohn Marino.Nm roundf , 34*05a0b428SJohn Marino.Nm roundl 35*05a0b428SJohn Marino.Nd round to nearest integral value 36*05a0b428SJohn Marino.Sh SYNOPSIS 37*05a0b428SJohn Marino.In math.h 38*05a0b428SJohn Marino.Ft double 39*05a0b428SJohn Marino.Fn round "double x" 40*05a0b428SJohn Marino.Ft float 41*05a0b428SJohn Marino.Fn roundf "float x" 42*05a0b428SJohn Marino.Ft long double 43*05a0b428SJohn Marino.Fn roundl "long double x" 44*05a0b428SJohn Marino.Sh DESCRIPTION 45*05a0b428SJohn MarinoThe 46*05a0b428SJohn Marino.Fn round , 47*05a0b428SJohn Marino.Fn roundf 48*05a0b428SJohn Marinoand 49*05a0b428SJohn Marino.Fn roundl 50*05a0b428SJohn Marinofunctions return the nearest integral value to 51*05a0b428SJohn Marino.Fa x ; 52*05a0b428SJohn Marinoif 53*05a0b428SJohn Marino.Fa x 54*05a0b428SJohn Marinolies halfway between two integral values, then these 55*05a0b428SJohn Marinofunctions return the integral value with the larger 56*05a0b428SJohn Marinoabsolute value (i.e., they round away from zero). 57*05a0b428SJohn Marino.Sh SEE ALSO 58*05a0b428SJohn Marino.Xr ceil 3 , 59*05a0b428SJohn Marino.Xr floor 3 , 60*05a0b428SJohn Marino.Xr lrint 3 , 61*05a0b428SJohn Marino.Xr lround 3 , 62*05a0b428SJohn Marino.Xr nextafter 3 , 63*05a0b428SJohn Marino.Xr rint 3 , 64*05a0b428SJohn Marino.Xr trunc 3 65*05a0b428SJohn Marino.Sh STANDARDS 66*05a0b428SJohn MarinoThese functions conform to 67*05a0b428SJohn Marino.St -isoC-99 . 68