xref: /openbsd/share/man/man9/imax.9 (revision 09467b48)
1.\"	$OpenBSD: imax.9,v 1.2 2018/04/23 11:11:38 jmc Exp $
2.\"
3.\" Copyright (c) 2002, 2003 CubeSoft Communications, Inc.
4.\" <http://www.csoft.org>
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
19.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20.\" (INCLUDING BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
23.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
24.\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE
25.\" POSSIBILITY OF SUCH DAMAGE.
26.\"
27.Dd $Mdocdate: April 23 2018 $
28.Dt IMAX 9
29.Os
30.Sh NAME
31.Nm imax ,
32.Nm imin ,
33.Nm lmax ,
34.Nm lmin ,
35.Nm max ,
36.Nm min ,
37.Nm ulmax ,
38.Nm ulmin ,
39.Nm abs
40.Nd kernel library math routines
41.Sh SYNOPSIS
42.In lib/libkern/libkern.h
43.Ft int
44.Fn imax "int a" "int b"
45.Ft int
46.Fn imin "int a" "int b"
47.Ft long
48.Fn lmax "long a" "long b"
49.Ft long
50.Fn lmin "long a" "long b"
51.Ft u_int
52.Fn max "u_int a" "u_int b"
53.Ft u_int
54.Fn min "u_int a" "u_int b"
55.Ft u_long
56.Fn ulmax "u_long a" "u_long b"
57.Ft u_long
58.Fn ulmin "u_long a" "u_long b"
59.Ft int
60.Fn abs "int j"
61.Sh DESCRIPTION
62The
63.Fn min ,
64.Fn imin ,
65.Fn lmin
66and
67.Fn ulmin
68functions return the smallest integer between
69.Fa a
70and
71.Fa b ,
72inclusive.
73The
74.Fn max ,
75.Fn imax ,
76.Fn lmax
77and
78.Fn ulmax
79functions return the largest integer between
80.Fa a
81and
82.Fa b ,
83inclusive.
84.Pp
85The
86.Fn abs
87function computes the absolute value of integer
88.Fa j .
89.Sh STANDARDS
90The
91.Fn abs
92function conforms to
93.St -ansiC .
94