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