summaryrefslogtreecommitdiffstats
path: root/upstream/opensuse-tumbleweed/man3/MAX.3
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 19:43:11 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 19:43:11 +0000
commitfc22b3d6507c6745911b9dfcc68f1e665ae13dbc (patch)
treece1e3bce06471410239a6f41282e328770aa404a /upstream/opensuse-tumbleweed/man3/MAX.3
parentInitial commit. (diff)
downloadmanpages-l10n-fc22b3d6507c6745911b9dfcc68f1e665ae13dbc.tar.xz
manpages-l10n-fc22b3d6507c6745911b9dfcc68f1e665ae13dbc.zip
Adding upstream version 4.22.0.upstream/4.22.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'upstream/opensuse-tumbleweed/man3/MAX.3')
-rw-r--r--upstream/opensuse-tumbleweed/man3/MAX.375
1 files changed, 75 insertions, 0 deletions
diff --git a/upstream/opensuse-tumbleweed/man3/MAX.3 b/upstream/opensuse-tumbleweed/man3/MAX.3
new file mode 100644
index 00000000..fddf2208
--- /dev/null
+++ b/upstream/opensuse-tumbleweed/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 2023-05-03 "Linux man-pages 6.05.01"
+.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>
+.PP
+.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.
+.PP
+The arguments may be evaluated more than once, or not at all.
+.PP
+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)