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/lrint.3,v 1.2 2005/01/13 10:43:01 ru Exp $ |
| 26 | .\" |
| 27 | .Dd January 11, 2005 |
| 28 | .Dt LRINT 3 |
| 29 | .Os |
| 30 | .Sh NAME |
| 31 | .Nm llrint , |
| 32 | .Nm llrintf , |
| 33 | .Nm lrint , |
| 34 | .Nm lrintf |
| 35 | .Nd "convert to integer" |
| 36 | .Sh LIBRARY |
| 37 | .Lb libm |
| 38 | .Sh SYNOPSIS |
| 39 | .In math.h |
| 40 | .Ft "long long" |
| 41 | .Fn llrint "double x" |
| 42 | .Ft "long long" |
| 43 | .Fn llrintf "float x" |
| 44 | .Ft long |
| 45 | .Fn lrint "double x" |
| 46 | .Ft long |
| 47 | .Fn lrintf "float x" |
| 48 | .Sh DESCRIPTION |
| 49 | The |
| 50 | .Fn lrint |
| 51 | function returns the integer nearest to its argument |
| 52 | .Fa x |
| 53 | according to the current rounding mode. |
| 54 | If the rounded result is too large to be represented as a |
| 55 | .Vt long |
| 56 | value, an invalid exception is raised and the return value is undefined. |
| 57 | Otherwise, if |
| 58 | .Fa x |
| 59 | is not an integer, |
| 60 | .Fn lrint |
| 61 | raises an inexact exception. |
| 62 | When the rounded result is representable as a |
| 63 | .Vt long , |
| 64 | the expression |
| 65 | .Fn lrint x |
| 66 | is equivalent to |
| 67 | .Po Vt long Pc Ns Fn rint x |
| 68 | (although the former may be more efficient). |
| 69 | .Pp |
| 70 | The |
| 71 | .Fn llrint , |
| 72 | .Fn llrintf , |
| 73 | and |
| 74 | .Fn lrintf |
| 75 | functions differ from |
| 76 | .Fn lrint |
| 77 | only in their input and output types. |
| 78 | .Sh SEE ALSO |
| 79 | .Xr lround 3 , |
| 80 | .Xr math 3 , |
| 81 | .Xr rint 3 , |
| 82 | .Xr round 3 |
| 83 | .Sh STANDARDS |
| 84 | The |
| 85 | .Fn llrint , |
| 86 | .Fn llrintf , |
| 87 | .Fn lrint , |
| 88 | and |
| 89 | .Fn lrintf |
| 90 | functions conform to |
| 91 | .St -isoC-99 . |
| 92 | .Sh HISTORY |
| 93 | These routines first appeared in |
| 94 | .Fx 5.4 . |