libm: Sync with FreeBSD (~50 math functions added)
[dragonfly.git] / lib / libm / man / trunc.3
1 .\" Copyright (c) 2004, 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 .\" $NetBSD: trunc.3,v 1.5 2006/04/04 20:26:33 wiz Exp $
26 .\" $FreeBSD: src/lib/msun/man/trunc.3,v 1.3 2005/06/15 19:04:04 ru Exp $
27 .\" $DragonFly: src/lib/libm/man/trunc.3,v 1.1 2007/06/17 06:26:18 pavalos Exp $
28 .\"
29 .Dd March 31, 2006
30 .Dt TRUNC 3
31 .Os
32 .Sh NAME
33 .Nm trunc ,
34 .Nm truncf
35 .\" .Nm truncl
36 .Nd "nearest integral value with magnitude less than or equal to |x|"
37 .Sh LIBRARY
38 .Lb libm
39 .Sh SYNOPSIS
40 .In math.h
41 .Ft double
42 .Fn trunc "double x"
43 .Ft float
44 .Fn truncf "float x"
45 .\" .Ft "long double"
46 .\" .Fn truncl "long double x"
47 .Sh DESCRIPTION
48 The
49 .Fn trunc
50 and
51 .Fn truncf
52 .\" .Fn truncl
53 functions return the nearest integral value with magnitude less than
54 or equal to
55 .Pf | Fa x Ns | .
56 They are equivalent to
57 .Fn rint
58 and
59 .Fn rintf
60 .\" .Fn rintl
61 respectively, in the
62 .Dv FP_RZ
63 rounding mode.
64 .Sh SEE ALSO
65 .Xr ceil 3 ,
66 .Xr floor 3 ,
67 .Xr fpsetround 3 ,
68 .Xr math 3 ,
69 .Xr nextafter 3 ,
70 .Xr rint 3 ,
71 .Xr round 3
72 .Sh STANDARDS
73 The
74 .Fn trunc
75 and
76 .Fn truncf
77 .\" .Fn truncl
78 functions conform to
79 .St -isoC-99 .