xref: /freebsd/lib/msun/man/fmaximum.3 (revision cfec995c87f39e59c80554b85625b4aaa8ddf8db)
1.\" Copyright (c) 2004 David Schultz <das@FreeBSD.org>
2.\" Copyright (c) 2026 Jesús Blázquez <jesuscblazquez@gmail.com>
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
26.Dd April 4, 2026
27.Dt FMAXIMUM 3
28.Os
29.Sh NAME
30.Nm fmaximum ,
31.Nm fmaximumf ,
32.Nm fmaximuml ,
33.Nm fminimum ,
34.Nm fminimumf ,
35.Nm fminimuml
36.Nd floating-point maximum and minimum functions
37.Sh LIBRARY
38.Lb libm
39.Sh SYNOPSIS
40.In math.h
41.Ft double
42.Fn fmaximum "double x" "double y"
43.Ft float
44.Fn fmaximumf "float x" "float y"
45.Ft "long double"
46.Fn fmaximuml "long double x" "long double y"
47.Ft double
48.Fn fminimum "double x" "double y"
49.Ft float
50.Fn fminimumf "float x" "float y"
51.Ft "long double"
52.Fn fminimuml "long double x" "long double y"
53.Sh DESCRIPTION
54The
55.Fn fmaximum ,
56.Fn fmaximumf ,
57and
58.Fn fmaximuml
59functions return the larger of
60.Fa x
61and
62.Fa y ,
63and likewise, the
64.Fn fminimum ,
65.Fn fminimumf ,
66and
67.Fn fminimuml
68functions return the smaller of
69.Fa x
70and
71.Fa y .
72They treat
73.Li +0.0
74as being larger than
75.Li -0.0 .
76.Pp
77Unlike the
78.Xr fmax 3
79family of functions, which ignore an \*(Na, if either argument to
80.Fn fmaximum
81or
82.Fn fminimum
83is an \*(Na, then the result is an \*(Na.
84These routines do not raise any floating-point exceptions.
85.Sh SEE ALSO
86.Xr fmax 3 ,
87.Xr fmaximum_num 3 ,
88.Xr fmaximum_mag 3 ,
89.Xr math 3
90.Sh STANDARDS
91The
92.Fn fmaximum ,
93.Fn fmaximumf ,
94.Fn fmaximuml ,
95.Fn fminimum ,
96.Fn fminimumf ,
97and
98.Fn fminimuml
99functions conform to
100.St -isoC-2023 .
101.Sh HISTORY
102These routines first appeared in
103.Fx 16.0 .
104