2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
6 .. index:: MAX, MIN, NaN
8 .. _max-and-min-intrinsics-with-real-nan-arguments:
10 MAX and MIN intrinsics with REAL NaN arguments
11 **********************************************
13 The Fortran standard does not specify what the result of the
14 ``MAX`` and ``MIN`` intrinsics are if one of the arguments is a
15 ``NaN``. Accordingly, the GNU Fortran compiler does not specify
16 that either, as this allows for faster and more compact code to be
17 generated. If the programmer wishes to take some specific action in
18 case one of the arguments is a ``NaN``, it is necessary to
19 explicitly test the arguments before calling ``MAX`` or ``MIN``,
20 e.g. with the ``IEEE_IS_NAN`` function from the intrinsic module