xref: /netbsd/lib/libm/man/trunc.3 (revision 0d045a7a)
1*0d045a7aSwiz.\"	$NetBSD: trunc.3,v 1.7 2013/11/13 22:11:52 wiz Exp $
2f1336fbdSxtraeme.\"
3f1336fbdSxtraeme.\" Copyright (c) 2004, 2005 David Schultz <das@FreeBSD.org>
4f1336fbdSxtraeme.\" All rights reserved.
5f1336fbdSxtraeme.\"
6f1336fbdSxtraeme.\" Redistribution and use in source and binary forms, with or without
7f1336fbdSxtraeme.\" modification, are permitted provided that the following conditions
8f1336fbdSxtraeme.\" are met:
9f1336fbdSxtraeme.\" 1. Redistributions of source code must retain the above copyright
10f1336fbdSxtraeme.\"    notice, this list of conditions and the following disclaimer.
11f1336fbdSxtraeme.\" 2. Redistributions in binary form must reproduce the above copyright
12f1336fbdSxtraeme.\"    notice, this list of conditions and the following disclaimer in the
13f1336fbdSxtraeme.\"    documentation and/or other materials provided with the distribution.
14f1336fbdSxtraeme.\"
15f1336fbdSxtraeme.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16f1336fbdSxtraeme.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17f1336fbdSxtraeme.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18f1336fbdSxtraeme.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19f1336fbdSxtraeme.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20f1336fbdSxtraeme.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21f1336fbdSxtraeme.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22f1336fbdSxtraeme.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23f1336fbdSxtraeme.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24f1336fbdSxtraeme.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25f1336fbdSxtraeme.\" SUCH DAMAGE.
26f1336fbdSxtraeme.\"
27f1336fbdSxtraeme.\" $FreeBSD: src/lib/msun/man/trunc.3,v 1.3 2005/06/15 19:04:04 ru Exp $
28f1336fbdSxtraeme.\"
2924a2e119Sjoerg.Dd November 13, 2013
30f1336fbdSxtraeme.Dt TRUNC 3
31f1336fbdSxtraeme.Os
32f1336fbdSxtraeme.Sh NAME
33f1336fbdSxtraeme.Nm trunc ,
34*0d045a7aSwiz.Nm truncf ,
3524a2e119Sjoerg.Nm truncl
36f1336fbdSxtraeme.Nd "nearest integral value with magnitude less than or equal to |x|"
37f4003bf3Skleink.Sh LIBRARY
38f4003bf3Skleink.Lb libm
39f1336fbdSxtraeme.Sh SYNOPSIS
40f1336fbdSxtraeme.In math.h
41f1336fbdSxtraeme.Ft double
42f1336fbdSxtraeme.Fn trunc "double x"
43f1336fbdSxtraeme.Ft float
44f1336fbdSxtraeme.Fn truncf "float x"
4524a2e119Sjoerg.Ft "long double"
4624a2e119Sjoerg.Fn truncl "long double x"
47f1336fbdSxtraeme.Sh DESCRIPTION
48f1336fbdSxtraemeThe
4924a2e119Sjoerg.Fn trunc ,
5024a2e119Sjoerg.Fn truncf ,
51f1336fbdSxtraemeand
5224a2e119Sjoerg.Fn truncl
53f1336fbdSxtraemefunctions return the nearest integral value with magnitude less than
54f1336fbdSxtraemeor equal to
55f1336fbdSxtraeme.Pf | Fa x Ns | .
56f1336fbdSxtraemeThey are equivalent to
5724a2e119Sjoerg.Fn rint ,
5824a2e119Sjoerg.Fn rintf ,
59f1336fbdSxtraemeand
6024a2e119Sjoerg.Fn rintl
61f1336fbdSxtraemerespectively, in the
6275d99205Sdrochner.Dv FP_RZ
63f1336fbdSxtraemerounding mode.
64f1336fbdSxtraeme.Sh SEE ALSO
65f1336fbdSxtraeme.Xr ceil 3 ,
66f1336fbdSxtraeme.Xr floor 3 ,
67e4293af9Swiz.Xr fpsetround 3 ,
68f1336fbdSxtraeme.Xr math 3 ,
69f1336fbdSxtraeme.Xr nextafter 3 ,
702660f986Suwe.Xr rint 3 ,
712660f986Suwe.Xr round 3
72f1336fbdSxtraeme.Sh STANDARDS
73f1336fbdSxtraemeThe
7424a2e119Sjoerg.Fn trunc ,
7524a2e119Sjoerg.Fn truncf ,
76f1336fbdSxtraemeand
7724a2e119Sjoerg.Fn truncl
78f1336fbdSxtraemefunctions conform to
79f1336fbdSxtraeme.St -isoC-99 .
80