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.\" 2507f3bc5bSDavid Schultz.Dd April 7, 2005 26d0f13633SDavid Schultz.Dt ROUND 3 27d0f13633SDavid Schultz.Os 28d0f13633SDavid Schultz.Sh NAME 29d0f13633SDavid Schultz.Nm round , 3007f3bc5bSDavid Schultz.Nm roundf , 3107f3bc5bSDavid Schultz.Nm roundl 32d0f13633SDavid Schultz.Nd round to nearest integral value 33d0f13633SDavid Schultz.Sh LIBRARY 34d0f13633SDavid Schultz.Lb libm 35d0f13633SDavid Schultz.Sh SYNOPSIS 36d0f13633SDavid Schultz.In math.h 37d0f13633SDavid Schultz.Ft double 38d0f13633SDavid Schultz.Fn round "double x" 39d0f13633SDavid Schultz.Ft float 40d0f13633SDavid Schultz.Fn roundf "float x" 41f789cb82SRuslan Ermilov.Ft "long double" 4207f3bc5bSDavid Schultz.Fn roundl "long double x" 43d0f13633SDavid Schultz.Sh DESCRIPTION 44d0f13633SDavid SchultzThe 4507f3bc5bSDavid Schultz.Fn round , 4607f3bc5bSDavid Schultz.Fn roundf , 47d0f13633SDavid Schultzand 4807f3bc5bSDavid Schultz.Fn roundl 49d0f13633SDavid Schultzfunctions return the nearest integral value to 50d0f13633SDavid Schultz.Fa x ; 51d0f13633SDavid Schultzif 52d0f13633SDavid Schultz.Fa x 53d0f13633SDavid Schultzlies halfway between two integral values, then these 54d0f13633SDavid Schultzfunctions return the integral value with the larger 55d0f13633SDavid Schultzabsolute value (i.e., they round away from zero). 56d0f13633SDavid Schultz.Sh SEE ALSO 57d0f13633SDavid Schultz.Xr ceil 3 , 58d0f13633SDavid Schultz.Xr floor 3 , 59d0f13633SDavid Schultz.Xr ieee 3 , 602aac156dSDavid Schultz.Xr lrint 3 , 612aac156dSDavid Schultz.Xr lround 3 , 62d0f13633SDavid Schultz.Xr math 3 , 63a9a0bf07SDavid Schultz.Xr rint 3 , 64a9a0bf07SDavid Schultz.Xr trunc 3 65d0f13633SDavid Schultz.Sh STANDARDS 6607f3bc5bSDavid SchultzThese functions conform to 67d0f13633SDavid Schultz.St -isoC-99 . 68d0f13633SDavid Schultz.Sh HISTORY 69d0f13633SDavid SchultzThe 70d0f13633SDavid Schultz.Fn round 71d0f13633SDavid Schultzand 72d0f13633SDavid Schultz.Fn roundf 73d0f13633SDavid Schultzfunctions appeared in 74d0f13633SDavid Schultz.Fx 5.3 . 7507f3bc5bSDavid SchultzThe 7607f3bc5bSDavid Schultz.Fn roundl 7707f3bc5bSDavid Schultzfunction appeared in 7807f3bc5bSDavid Schultz.Fx 6.0 . 79