Joseph Myers <jos...@codesourcery.com> writes: > On Fri, 28 Feb 2020, Tobias Burnus wrote: > >> Regarding MIN and MAX: I think the IEEE 754 decided at some point >> decided that MAX(x, NaN) = x (IEEE 754:2008 alias ISO 60559:2011, if I >> recall correctly). I think one has to check what exactly the test case >> does and what is guaranteed where. I also do not know whether a more >> recent IEEE 754 (754:2019) has changed something again. > > It has. The maxNum/minNum operations from IEEE 754-2008 were removed and > replaced by recommended operations maximum/minimum (treat NaNs the same > way as other operations do, i.e. produce a quiet NaN result if either > operand is a NaN) and maximumNumber/minimumNumber (return the number if > the other operand is a NaN, even a signaling NaN, with "invalid" raised in > the signaling NaN case). Those new operations also treat +0 as greater > than -0, whereas maxNum/minNum did not specify the result in that case. > (The choice of which operand is the result is still unspecified when the > two operands are different DFP members of the same cohort, i.e. with > different quantum exponents.)
Hi, Thanks for all your great comments! IEEE 754 also updates the behavior of min/max on NaN, and seems try to meet difference purpose with special operations. So, I feel GNU Fortran manual is still a good decision as: https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gfortran/MAX-and-MIN-intrinsics-with-REAL-NaN-arguments.html#MAX-and-MIN-intrinsics-with-REAL-NaN-arguments It is undefined to use max/min on NaN without check IS_NAN or without using specified IEEE operations. Jiufu