1 .\" Copyright (C) 2021 Alejandro Colomar <alx.manpages@gmail.com>
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .TH MAX 3 2020-11-01 "Linux man-pages (unreleased)" "Linux Programmer's Manual"
7 MAX, MIN \- maximum or minimum of two values
10 .RI ( libc ", " \-lc )
13 .B #include <sys/param.h>
19 These macros return the maximum or minimum of
24 These macros return the value of one of their arguments,
25 possibly converted to a different type (see BUGS).
27 These macros may raise the "invalid" floating-point exception
28 when any of the arguments is NaN.
30 These nonstandard macros are present in glibc and the BSDs.
32 If either of the arguments is of a floating-point type,
33 you might prefer to use
39 The arguments may be evaluated more than once, or not at all.
41 Some UNIX systems might provide these macros in a different header,
44 Due to the usual arithmetic conversions,
45 the result of these macros may be very different from either of the arguments.
46 To avoid this, ensure that both arguments have the same type.
51 #include <sys/param.h>
54 main(int argc, char *argv[])
59 fprintf(stderr, "Usage: %s <num> <num>\en", argv[0]);
66 printf("MAX(%d, %d) is %d\en", a, b, x);