aboutsummaryrefslogtreecommitdiffstats
path: root/man/man3/MAX.3
diff options
context:
space:
mode:
authorAlejandro Colomar <alx@kernel.org>2024-04-26 15:06:49 +0200
committerAlejandro Colomar <alx@kernel.org>2024-05-02 01:24:19 +0200
commitdcde2f70372b49ec43efc5db864c9ff585d0a2dd (patch)
tree78b9b7425130e4a5858e4c01a524d802423879ed /man/man3/MAX.3
parent12aca537ce78a41bbcdaf485209691e10f8002d7 (diff)
downloadman-pages-dcde2f70372b49ec43efc5db864c9ff585d0a2dd.tar.gz
man/, share/mk/: Move man*/ to man/
This is a scripted change: $ mkdir man/; $ mv man* man/; $ ln -st . man/man*; $ find share/mk/ -type f \ | xargs grep -l '^MANDIR *:=' \ | xargs sed -i '/^MANDIR *:=/s,$,/man,'; $ find share/mk/dist/ -type f \ | xargs grep -l man \ | xargs sed -i 's,man%,man/%,g'; Link: <https://lore.kernel.org/linux-man/YxcV4h+Xn7cd6+q2@pevik/T/> Cc: Petr Vorel <pvorel@suse.cz> Cc: Jakub Wilk <jwilk@jwilk.net> Cc: Stefan Puiu <stefan.puiu@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
Diffstat (limited to 'man/man3/MAX.3')
-rw-r--r--man/man3/MAX.375
1 files changed, 75 insertions, 0 deletions
diff --git a/man/man3/MAX.3 b/man/man3/MAX.3
new file mode 100644
index 0000000000..9e74ad6144
--- /dev/null
+++ b/man/man3/MAX.3
@@ -0,0 +1,75 @@
+.\" Copyright (C) 2021 Alejandro Colomar <alx@kernel.org>
+.\"
+.\" SPDX-License-Identifier: Linux-man-pages-copyleft
+.\"
+.TH MAX 3 (date) "Linux man-pages (unreleased)"
+.SH NAME
+MAX, MIN \- maximum or minimum of two values
+.SH LIBRARY
+Standard C library
+.RI ( libc ", " \-lc )
+.SH SYNOPSIS
+.nf
+.B #include <sys/param.h>
+.P
+.BI MAX( a ", " b );
+.BI MIN( a ", " b );
+.fi
+.SH DESCRIPTION
+These macros return the maximum or minimum of
+.I a
+and
+.IR b .
+.SH RETURN VALUE
+These macros return the value of one of their arguments,
+possibly converted to a different type (see BUGS).
+.SH ERRORS
+These macros may raise the "invalid" floating-point exception
+when any of the arguments is NaN.
+.SH STANDARDS
+GNU, BSD.
+.SH NOTES
+If either of the arguments is of a floating-point type,
+you might prefer to use
+.BR fmax (3)
+or
+.BR fmin (3),
+which can handle NaN.
+.P
+The arguments may be evaluated more than once, or not at all.
+.P
+Some UNIX systems might provide these macros in a different header,
+or not at all.
+.SH BUGS
+Due to the usual arithmetic conversions,
+the result of these macros may be very different from either of the arguments.
+To avoid this, ensure that both arguments have the same type.
+.SH EXAMPLES
+.\" SRC BEGIN (MAX.c)
+.EX
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/param.h>
+\&
+int
+main(int argc, char *argv[])
+{
+ int a, b, x;
+\&
+ if (argc != 3) {
+ fprintf(stderr, "Usage: %s <num> <num>\en", argv[0]);
+ exit(EXIT_FAILURE);
+ }
+\&
+ a = atoi(argv[1]);
+ b = atoi(argv[2]);
+ x = MAX(a, b);
+ printf("MAX(%d, %d) is %d\en", a, b, x);
+\&
+ exit(EXIT_SUCCESS);
+}
+.EE
+.\" SRC END
+.SH SEE ALSO
+.BR fmax (3),
+.BR fmin (3)