Spec-Zone.ru › Linux man pages

MAX(3) — Справочная страница Linux

MAX(3)                  Library Functions Manual                  MAX(3)

ИМЯ

       MAX, MIN - maximum or minimum of two values

БИБЛИОТЕКА

       Standard C library (libc, -lc)

СИНТАКСИС

       #include <sys/param.h>

       MAX(a, b);
       MIN(a, b);

ОПИСАНИЕ

       These macros return the maximum or minimum of a and b.

ЗНАЧЕНИЕ, ВОЗВРАЩАЕМОЕ ФУНКЦИЕЙ

       These macros return the value of one of their arguments, possibly
       converted to a different type (see BUGS).

ОШИБКИ

       These macros may raise the "invalid" floating-point exception
       when any of the arguments is NaN.

СТАНДАРТЫ

       GNU, BSD.

ПРИМЕЧАНИЯ

       If either of the arguments is of a floating-point type, you might
       prefer to use fmax(3) or fmin(3), which can handle NaN.

       The arguments may be evaluated more than once, or not at all.

       Some UNIX systems might provide these macros in a different
       header, or not at all.

НЕДОСТАТКИ

       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.

ПРИМЕРЫ

       #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>\n", argv[0]);
               exit(EXIT_FAILURE);
           }

           a = atoi(argv[1]);
           b = atoi(argv[2]);
           x = MAX(a, b);
           printf("MAX(%d, %d) is %d\n", a, b, x);

           exit(EXIT_SUCCESS);
       }

СМОТРИТЕ ТАКЖЕ

       fmax(3), fmin(3)

КОЛОФОН

       This page is part of the man-pages (Linux kernel and C library
       user-space interface documentation) project.  Information about
       the project can be found at 
       ⟨https://www.kernel.org/doc/man-pages/⟩.  If you have a bug report
       for this manual page, see
       ⟨https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/CONTRIBUTING⟩.
       This page was obtained from the tarball man-pages-6.9.1.tar.gz
       fetched from
       ⟨https://mirrors.edge.kernel.org/pub/linux/docs/man-pages/⟩ on
       2024-06-26.  If you discover any rendering problems in this HTML
       version of the page, or you believe there is a better or more up-
       to-date source for the page, or you have corrections or
       improvements to the information in this COLOPHON (which is not
       part of the original manual page), send a mail to
       man-pages@man7.org

Linux man-pages 6.9.1          2024-06-15                         MAX(3)

...
https://man7.org/linux/man-pages/man3/MAX.3.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API