blob: ee55feaf223813e45f71c3f590ce9c055934a319 [file] [log] [blame]
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001.\" Copyright (c) 1985, 1991 Regents of the University of California.
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.\" 3. All advertising materials mentioning features or use of this software
13.\" must display the following acknowledgement:
14.\" This product includes software developed by the University of
15.\" California, Berkeley and its contributors.
16.\" 4. Neither the name of the University nor the names of its contributors
17.\" may be used to endorse or promote products derived from this software
18.\" without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" from: @(#)rint.3 5.1 (Berkeley) 5/2/91
33.\" $FreeBSD: src/lib/msun/man/rint.3,v 1.11 2005/01/11 23:12:17 das Exp $
34.\"
35.Dd July 5, 2004
36.Dt RINT 3
37.Os
38.Sh NAME
39.Nm nearbyint ,
40.Nm nearbyintf ,
41.Nm rint ,
42.Nm rintf
43.Nd round to integral value in floating-point format
44.Sh LIBRARY
45.Lb libm
46.Sh SYNOPSIS
47.In math.h
48.Ft double
49.Fn nearbyint "double x"
50.Ft float
51.Fn nearbyintf "float x"
52.Ft double
53.Fn rint "double x"
54.Ft float
55.Fn rintf "float x"
56.Sh DESCRIPTION
57The
58.Fn rint
59and the
60.Fn rintf
61functions return the integral value nearest to
62.Fa x
63according to the prevailing rounding mode.
64These functions raise an inexact exception when the original argument
65is not an exact integer.
66.Pp
67The
68.Fn nearbyint
69and
70.Fn nearbyintf
71functions perform the same operation, except that they do not raise
72an inexact exception.
73.Sh SEE ALSO
74.Xr abs 3 ,
75.Xr ceil 3 ,
76.Xr fabs 3 ,
77.Xr fenv 3 ,
78.Xr floor 3 ,
79.Xr ieee 3 ,
80.Xr lrint 3 ,
81.Xr lround 3 ,
82.Xr math 3 ,
83.Xr round 3
84.Sh STANDARDS
85The
86.Fn nearbyint ,
87.Fn nearbyintf ,
88.Fn rint ,
89and
90.Fn rintf
91functions conform to
92.St -isoC-99 .
93.Sh HISTORY
94A
95.Fn rint
96function appeared in
97.At v6 .
98The
99.Fn nearbyint
100and
101.Fn nearbyintf
102functions appeared in
103.Fx 5.3 .