xref: /freebsd/lib/msun/man/fmaximum_num.3 (revision 4e30c12973c73539bef01be3870a90b6346141e8)
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 3, 2026
27.Dt FMAXIMUM_NUM 3
28.Os
29.Sh NAME
30.Nm fmaximum_num ,
31.Nm fmaximum_numf ,
32.Nm fmaximum_numl ,
33.Nm fminimum_num ,
34.Nm fminimum_numf ,
35.Nm fminimum_numl
36.Nd floating-point maximum and minimum number functions
37.Sh LIBRARY
38.Lb libm
39.Sh SYNOPSIS
40.In math.h
41.Ft double
42.Fn fmaximum_num "double x" "double y"
43.Ft float
44.Fn fmaximum_numf "float x" "float y"
45.Ft "long double"
46.Fn fmaximum_numl "long double x" "long double y"
47.Ft double
48.Fn fminimum_num "double x" "double y"
49.Ft float
50.Fn fminimum_numf "float x" "float y"
51.Ft "long double"
52.Fn fminimum_numl "long double x" "long double y"
53.Sh DESCRIPTION
54The
55.Fn fmaximum_num ,
56.Fn fmaximum_numf ,
57and
58.Fn fmaximum_numl
59functions determine the larger of
60.Fa x
61and
62.Fa y ,
63preferring a numeric value over an \*(Na.
64If one argument is a numeric value and the other is an \*(Na,
65the numeric value is returned.
66If both arguments are numeric, the larger value is returned.
67If both arguments are \*(Nas, a quiet \*(Na is returned.
68For the purpose of these functions, positive zero is considered
69greater than negative zero.
70.Pp
71Likewise, the
72.Fn fminimum_num ,
73.Fn fminimum_numf ,
74and
75.Fn fminimum_numl
76functions determine the smaller of
77.Fa x
78and
79.Fa y ,
80preferring a numeric value over an \*(Na.
81If one argument is a numeric value and the other is an \*(Na,
82the numeric value is returned.
83If both arguments are numeric, the smaller value is returned.
84If both arguments are \*(Nas, a quiet \*(Na is returned.
85For the purpose of these functions, negative zero is considered
86less than positive zero.
87.Pp
88Unlike with the
89.Xr fmaximum 3
90and
91.Xr fmaximum_mag 3
92families of functions, if either argument is a signaling \*(Na,
93an invalid exception is raised.
94Otherwise, these routines do not raise any floating-point exceptions.
95.Sh SEE ALSO
96.Xr fmax 3 ,
97.Xr fmaximum 3 ,
98.Xr fmaximum_mag 3 ,
99.Xr math 3
100.Sh STANDARDS
101The
102.Fn fmaximum_num ,
103.Fn fmaximum_numf ,
104.Fn fmaximum_numl ,
105.Fn fminimum_num ,
106.Fn fminimum_numf ,
107and
108.Fn fminimum_numl
109functions conform to
110.St -isoC-2023 .
111.Sh HISTORY
112These routines first appeared in
113.Fx 16.0 .
114