1d0f13633SDavid Schultz.\" Copyright (c) 2003, Steven G. Kargl 2d0f13633SDavid Schultz.\" All rights reserved. 3d0f13633SDavid Schultz.\" 4d0f13633SDavid Schultz.\" Redistribution and use in source and binary forms, with or without 5d0f13633SDavid Schultz.\" modification, are permitted provided that the following conditions 6d0f13633SDavid Schultz.\" are met: 7d0f13633SDavid Schultz.\" 1. Redistributions of source code must retain the above copyright 8d0f13633SDavid Schultz.\" notice, this list of conditions and the following disclaimer. 9d0f13633SDavid Schultz.\" 2. Redistributions in binary form must reproduce the above copyright 10d0f13633SDavid Schultz.\" notice, this list of conditions and the following disclaimer in the 11d0f13633SDavid Schultz.\" documentation and/or other materials provided with the distribution. 12d0f13633SDavid Schultz.\" 13d0f13633SDavid Schultz.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 14d0f13633SDavid Schultz.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15d0f13633SDavid Schultz.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16d0f13633SDavid Schultz.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 17d0f13633SDavid Schultz.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18d0f13633SDavid Schultz.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19d0f13633SDavid Schultz.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20d0f13633SDavid Schultz.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21d0f13633SDavid Schultz.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22d0f13633SDavid Schultz.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23d0f13633SDavid Schultz.\" SUCH DAMAGE. 24d0f13633SDavid Schultz.\" 25d0f13633SDavid Schultz.\" $FreeBSD$ 26d0f13633SDavid Schultz.\" 2707f3bc5bSDavid Schultz.Dd April 7, 2005 28d0f13633SDavid Schultz.Dt ROUND 3 29d0f13633SDavid Schultz.Os 30d0f13633SDavid Schultz.Sh NAME 31d0f13633SDavid Schultz.Nm round , 3207f3bc5bSDavid Schultz.Nm roundf , 3307f3bc5bSDavid Schultz.Nm roundl 34d0f13633SDavid Schultz.Nd round to nearest integral value 35d0f13633SDavid Schultz.Sh LIBRARY 36d0f13633SDavid Schultz.Lb libm 37d0f13633SDavid Schultz.Sh SYNOPSIS 38d0f13633SDavid Schultz.In math.h 39d0f13633SDavid Schultz.Ft double 40d0f13633SDavid Schultz.Fn round "double x" 41d0f13633SDavid Schultz.Ft float 42d0f13633SDavid Schultz.Fn roundf "float x" 43f789cb82SRuslan Ermilov.Ft "long double" 4407f3bc5bSDavid Schultz.Fn roundl "long double x" 45d0f13633SDavid Schultz.Sh DESCRIPTION 46d0f13633SDavid SchultzThe 4707f3bc5bSDavid Schultz.Fn round , 4807f3bc5bSDavid Schultz.Fn roundf , 49d0f13633SDavid Schultzand 5007f3bc5bSDavid Schultz.Fn roundl 51d0f13633SDavid Schultzfunctions return the nearest integral value to 52d0f13633SDavid Schultz.Fa x ; 53d0f13633SDavid Schultzif 54d0f13633SDavid Schultz.Fa x 55d0f13633SDavid Schultzlies halfway between two integral values, then these 56d0f13633SDavid Schultzfunctions return the integral value with the larger 57d0f13633SDavid Schultzabsolute value (i.e., they round away from zero). 58d0f13633SDavid Schultz.Sh SEE ALSO 59d0f13633SDavid Schultz.Xr ceil 3 , 60d0f13633SDavid Schultz.Xr floor 3 , 61d0f13633SDavid Schultz.Xr ieee 3 , 622aac156dSDavid Schultz.Xr lrint 3 , 632aac156dSDavid Schultz.Xr lround 3 , 64d0f13633SDavid Schultz.Xr math 3 , 65a9a0bf07SDavid Schultz.Xr rint 3 , 66a9a0bf07SDavid Schultz.Xr trunc 3 67d0f13633SDavid Schultz.Sh STANDARDS 6807f3bc5bSDavid SchultzThese functions conform to 69d0f13633SDavid Schultz.St -isoC-99 . 70d0f13633SDavid Schultz.Sh HISTORY 71d0f13633SDavid SchultzThe 72d0f13633SDavid Schultz.Fn round 73d0f13633SDavid Schultzand 74d0f13633SDavid Schultz.Fn roundf 75d0f13633SDavid Schultzfunctions appeared in 76d0f13633SDavid Schultz.Fx 5.3 . 7707f3bc5bSDavid SchultzThe 7807f3bc5bSDavid Schultz.Fn roundl 7907f3bc5bSDavid Schultzfunction appeared in 8007f3bc5bSDavid Schultz.Fx 6.0 . 81