Date: Wed, 28 Nov 2001 07:00:37 -0700 (MST) From: "Nelson H. F. Beebe" To: "David G. Hough" Cc: beebe@math.utah.edu X-US-Mail: "Center for Scientific Computing, Department of Mathematics, 322 INSCC, University of Utah, 155 S 1400 E RM 233, Salt Lake City, UT 84112-0090, USA" X-Telephone: +1 801 581 5254 X-FAX: +1 801 585 1640, +1 801 581 4148 X-URL: http://www.math.utah.edu/~beebe Subject: Comment on http://www.validlab.com/754R/proposals/minmax/minmax.pdf Message-ID: [This message is long, and thus off the stds-754 list to reduce list clutter; please feel free to summarize and repost anything you care to.] In http://www.validlab.com/754R/proposals/minmax/minmax.pdf is this statement: >> ... >> If x is a number and y is a quiet NaN, then min(x,y), (y,x), max(x,y), >> and max(y,x) return x with no exception. >> ... I found this very surprising. With no exception that I can think of, other than isNaN() and isNaN()-like datatype test functions, no C, C++, or Fortran numerical elementary functions of one argument return anything but a NaN for a NaN argument. The same applies to atan2(x,y). I believe strongly that, in the interests of user predictability, any multi-argument min() or max() function should return a (quiet) NaN if ANY of its arguments are NaN. Now, it is true that a common, but naive, implementation of min() and max() may have what I call undesirable behavior because of the faulty assumption that there are only two outcomes of comparison, rather than the three of IEEE 754: float max(float x, float y) { return ((x > y) ? x : y); } float min(float x, float y) { return ((x < y) ? x : y); } These produce anomalous results like this: max( 1.00, NaN) -> NaN min( 1.00, NaN) -> NaN max( NaN, 1.00) -> 1.00 min( NaN, 1.00) -> 1.00 max( NaN, NaN) -> NaN min( NaN, NaN) -> NaN However, an IEEE-754 aware implementation might look like this: int isNaN(float x) { return (x != x); } float max(float x, float y) { if (isNaN(x)) return (x); else if (isNaN(y)) return (y); else return ((x > y) ? x : y); } float min(float x, float y) { if (isNaN(x)) return (x); else if (isNaN(y)) return (y); else return ((x < y) ? x : y); } in which case the output is what I consider correct: max( 1.00, NaN) -> NaN min( 1.00, NaN) -> NaN max( NaN, 1.00) -> NaN min( NaN, 1.00) -> NaN max( NaN, NaN) -> NaN min( NaN, NaN) -> NaN C and C++ lack min() and max() functions, so they are not good candidates for testing existing practice. However, Fortran does have them, so I investigated their behavior with this test program: % cat minmax.f real NaN NaN = store(0.0) NaN = NaN/store(NaN) call test(1.0, 2.0) call test(1.0, NaN) call test(NaN, 1.0) call test(NaN, NaN) end real function store(x) real x store = x return end subroutine test(x,y) real x, y write (6,1000) 'max', x, y, max(x,y) write (6,1000) 'min', x, y, min(x,y) 1000 format (a,'(', f5.2, ',', f5.2, ') ->', f5.2) end and this wrapper script to try all known compilers [the script is nontrivial because several compilers need special options to get nonstop IEEE 754 behavior, instead of abrupt termination on a floating-point exception, or to identify the Fortran-77-style fixed source form to the compiler]: % cat minmax.sh #! /bin/sh ### ==================================================================== ### Test the minmax.f Fortran program with all known compilers. ### [28-Nov-2001] ### ==================================================================== mywhich() { case $1 in /*) # Handle absolute path case separately test -f $1 && echo "$@" && return ;; *) # else search PATH for d in ` echo $PATH | sed -e 's/:/ /g' ` do test -f $d/$1 && echo $d/"$@" && return done echo "" ;; esac } os=`uname -s` arch=`uname -m` for FC in \ f77 g77 f90 f95 fort lf95 "nagf90 -ieee=full" "nagf95 -ieee=full" \ pgf77 pgf90 pghpf sgif90 xlf xlf90 xlf95 do FFLAGS= case $os in AIX) case $FC in xlf90) FFLAGS=-qfixed ;; xlf95) FFLAGS=-qfixed ;; esac ;; Linux) case $arch in alpha) case $FC in fort) FFLAGS=-fpe3 ;; *) FFLAGS=-mieee ;; esac ;; esac ;; OSF1) case $FC in f77) FFLAGS=-fpe3 ;; f90) FFLAGS=-fpe3 ;; f95) FFLAGS=-fpe3 ;; g77) FFLAGS=-mieee ;; esac ;; SunOS) case $FC in f90) FFLAGS="-ftrap=%none" ;; f95) FFLAGS="-ftrap=%none" ;; esac ;; esac /bin/rm -f ./a.out 1>/dev/null 2>&1 if test ! -z "`mywhich $FC`" then echo "------------------------------------------------------------------------" echo Architecture: `$HOME/bin/machinetype || uname -a || true` echo "$FC -g $FFLAGS minmax.f" $FC -g $FFLAGS minmax.f 1>/dev/null 2>&1 && ./a.out 2>/dev/null fi done Attached below is a log of what I found (for the SGI, I had to widen the output format). There are 61 compiler tests on 15 different UNIX platforms. There are evident deficiencies in these results, with ALL systems handling the case of a finite/NaN pair differently, depending on the argument order. It is exactly this kind of nonsensical variation that IEEE 754 can help to eliminate. Numerical function results need to be predictable across platforms. This little awk program applied to this message summarizes the count of NaNs returned: %cat foo.awk /^Arch/ { ARCH = $0; next } { $0 = tolower($0) } /^---/ { print NNAN, ARCH; NNAN = 0; ARCH="" } /^max\(.*>.*nan/ { NNAN++ } /^min\(.*>.*nan/ { NNAN++ } END { print NNAN, ARCH } All systems returned exactly four NaNs, whereas my proposal would produce six NaNs. ------------------------------------------------------------------------ Architecture: Power Macintosh (233 MHz); GNU/Linux 2.2.15pre9 f77 -g minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, nan) -> nan min( 1.00, nan) -> nan max( nan, 1.00) -> 1.00 min( nan, 1.00) -> 1.00 max( nan, nan) -> nan min( nan, nan) -> nan ------------------------------------------------------------------------ Architecture: Power Macintosh (233 MHz); GNU/Linux 2.2.15pre9 g77 -g minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, nan) -> nan min( 1.00, nan) -> nan max( nan, 1.00) -> 1.00 min( nan, 1.00) -> 1.00 max( nan, nan) -> nan min( nan, nan) -> nan ------------------------------------------------------------------------ Architecture: Apple PowerMac G4 (2 533 MHz CPUs, 256MB RAM); Darwin 1.4 f77 -g minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, NaN) -> NaN min( 1.00, NaN) -> NaN max( NaN, 1.00) -> 1.00 min( NaN, 1.00) -> 1.00 max( NaN, NaN) -> NaN min( NaN, NaN) -> NaN ------------------------------------------------------------------------ Architecture: Apple PowerMac G3 (267 MHz); GNU/Linux 2.2.18-4hpmac f77 -g minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, nan) -> nan min( 1.00, nan) -> nan max( nan, 1.00) -> 1.00 min( nan, 1.00) -> 1.00 max( nan, nan) -> nan min( nan, nan) -> nan ------------------------------------------------------------------------ Architecture: Apple PowerMac G3 (267 MHz); GNU/Linux 2.2.18-4hpmac g77 -g minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, nan) -> nan min( 1.00, nan) -> nan max( nan, 1.00) -> 1.00 min( nan, 1.00) -> 1.00 max( nan, nan) -> nan min( nan, nan) -> nan ------------------------------------------------------------------------ Architecture: Apple PowerMac G3 (266 MHz); Yellow Dog GNU/Linux 2.4.10-12a f77 -g minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, nan) -> nan min( 1.00, nan) -> nan max( nan, 1.00) -> 1.00 min( nan, 1.00) -> 1.00 max( nan, nan) -> nan min( nan, nan) -> nan ------------------------------------------------------------------------ Architecture: Apple PowerMac G3 (266 MHz); Yellow Dog GNU/Linux 2.4.10-12a g77 -g minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, nan) -> nan min( 1.00, nan) -> nan max( nan, 1.00) -> 1.00 min( nan, 1.00) -> 1.00 max( nan, nan) -> nan min( nan, nan) -> nan ------------------------------------------------------------------------ Architecture: DEC Alpha 4100-5/266 (4 CPUs, 466 MHz, 2GB RAM); OSF/1 4.0F f77 -g -fpe3 minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, NaN ) -> 1.00 min( 1.00, NaN ) -> NaN max( NaN , 1.00) -> NaN min( NaN , 1.00) -> 1.00 max( NaN , NaN ) -> NaN min( NaN , NaN ) -> NaN ------------------------------------------------------------------------ Architecture: DEC Alpha 4100-5/266 (4 CPUs, 466 MHz, 2GB RAM); OSF/1 4.0F g77 -g -mieee minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, NaNQ) -> 1.00 min( 1.00, NaNQ) -> NaNQ max( NaNQ, 1.00) -> NaNQ min( NaNQ, 1.00) -> 1.00 max( NaNQ, NaNQ) -> NaNQ min( NaNQ, NaNQ) -> NaNQ ------------------------------------------------------------------------ Architecture: DEC Alpha 4100-5/266 (4 CPUs, 466 MHz, 2GB RAM); OSF/1 4.0F f90 -g -fpe3 minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, NaN ) -> 1.00 min( 1.00, NaN ) -> NaN max( NaN , 1.00) -> NaN min( NaN , 1.00) -> 1.00 max( NaN , NaN ) -> NaN min( NaN , NaN ) -> NaN ------------------------------------------------------------------------ Architecture: DEC Alpha 4100-5/266 (4 CPUs, 466 MHz, 2GB RAM); OSF/1 4.0F f95 -g -fpe3 minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, NaN ) -> 1.00 min( 1.00, NaN ) -> NaN max( NaN , 1.00) -> NaN min( NaN , 1.00) -> 1.00 max( NaN , NaN ) -> NaN min( NaN , NaN ) -> NaN ------------------------------------------------------------------------ Architecture: DEC Alpha 4100-5/266 (4 CPUs, 466 MHz, 2GB RAM); OSF/1 4.0F nagf90 -ieee=full -g minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, NaNQ) -> NaNQ min( 1.00, NaNQ) -> NaNQ max( NaNQ, 1.00) -> 1.00 min( NaNQ, 1.00) -> 1.00 max( NaNQ, NaNQ) -> NaNQ min( NaNQ, NaNQ) -> NaNQ ------------------------------------------------------------------------ Architecture: DEC Alpha 4100-5/266 (4 CPUs, 466 MHz, 2GB RAM); OSF/1 4.0F nagf95 -ieee=full -g minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, NaNQ) -> NaNQ min( 1.00, NaNQ) -> NaNQ max( NaNQ, 1.00) -> 1.00 min( NaNQ, 1.00) -> 1.00 max( NaNQ, NaNQ) -> NaNQ min( NaNQ, NaNQ) -> NaNQ ------------------------------------------------------------------------ Architecture: Compaq AlphaServer DS20 Sierra/667 (EV?? 21264 CPU, 667 MHz, ????MB RAM ); OSF/1 5.0 f77 -g -fpe3 minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, NaN ) -> 1.00 min( 1.00, NaN ) -> NaN max( NaN , 1.00) -> NaN min( NaN , 1.00) -> 1.00 max( NaN , NaN ) -> NaN min( NaN , NaN ) -> NaN ------------------------------------------------------------------------ Architecture: Compaq AlphaServer DS20 Sierra/667 (EV?? 21264 CPU, 667 MHz, ????MB RAM ); OSF/1 5.0 f90 -g -fpe3 minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, NaN ) -> 1.00 min( 1.00, NaN ) -> NaN max( NaN , 1.00) -> NaN min( NaN , 1.00) -> 1.00 max( NaN , NaN ) -> NaN min( NaN , NaN ) -> NaN ------------------------------------------------------------------------ Architecture: Compaq AlphaServer DS20 Sierra/667 (EV?? 21264 CPU, 667 MHz, ????MB RAM ); OSF/1 5.0 f95 -g -fpe3 minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, NaN ) -> 1.00 min( 1.00, NaN ) -> NaN max( NaN , 1.00) -> NaN min( NaN , 1.00) -> 1.00 max( NaN , NaN ) -> NaN min( NaN , NaN ) -> NaN ------------------------------------------------------------------------ Architecture: DEC Alphastation 200 4/100 (1 CPU, 100 MHz Alpha 21064 EV4, 64MB RAM); GNU/Linux 2.2.19-6.2.1 f77 -g -mieee minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, nan) -> 1.00 min( 1.00, nan) -> nan max( nan, 1.00) -> nan min( nan, 1.00) -> 1.00 max( nan, nan) -> nan min( nan, nan) -> nan ------------------------------------------------------------------------ Architecture: DEC Alphastation 200 4/100 (1 CPU, 100 MHz Alpha 21064 EV4, 64MB RAM); GNU/Linux 2.2.19-6.2.1 g77 -g -mieee minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, nan) -> 1.00 min( 1.00, nan) -> nan max( nan, 1.00) -> nan min( nan, 1.00) -> 1.00 max( nan, nan) -> nan min( nan, nan) -> nan ------------------------------------------------------------------------ Architecture: DEC Alphastation 200 4/100 (1 CPU, 100 MHz Alpha 21064 EV4, 64MB RAM); GNU/Linux 2.2.19-6.2.1 fort -g -fpe3 minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, NaN ) -> 1.00 min( 1.00, NaN ) -> NaN max( NaN , 1.00) -> NaN min( NaN , 1.00) -> 1.00 max( NaN , NaN ) -> NaN min( NaN , NaN ) -> NaN ------------------------------------------------------------------------ Architecture: IBM RS6000 43P-132 (133 MHz); AIX 4.2 f77 -g minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, NaNQ) -> 1.00 min( 1.00, NaNQ) -> 1.00 max( NaNQ, 1.00) -> NaNQ min( NaNQ, 1.00) -> NaNQ max( NaNQ, NaNQ) -> NaNQ min( NaNQ, NaNQ) -> NaNQ ------------------------------------------------------------------------ Architecture: IBM RS6000 43P-132 (133 MHz); AIX 4.2 g77 -g minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, NaNQ) -> NaNQ min( 1.00, NaNQ) -> NaNQ max( NaNQ, 1.00) -> 1.00 min( NaNQ, 1.00) -> 1.00 max( NaNQ, NaNQ) -> NaNQ min( NaNQ, NaNQ) -> NaNQ ------------------------------------------------------------------------ Architecture: IBM RS6000 43P-132 (133 MHz); AIX 4.2 xlf -g minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, NaNQ) -> 1.00 min( 1.00, NaNQ) -> 1.00 max( NaNQ, 1.00) -> NaNQ min( NaNQ, 1.00) -> NaNQ max( NaNQ, NaNQ) -> NaNQ min( NaNQ, NaNQ) -> NaNQ ------------------------------------------------------------------------ Architecture: IBM RS6000 43P-132 (133 MHz); AIX 4.2 xlf90 -g minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, NaNQ) -> 1.00 min( 1.00, NaNQ) -> 1.00 max( NaNQ, 1.00) -> NaNQ min( NaNQ, 1.00) -> NaNQ max( NaNQ, NaNQ) -> NaNQ min( NaNQ, NaNQ) -> NaNQ ------------------------------------------------------------------------ Architecture: IBM SP2 (166 MHz); AIX 4.3.2.0 f77 -g minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, NaNQ) -> 1.00 min( 1.00, NaNQ) -> NaNQ max( NaNQ, 1.00) -> NaNQ min( NaNQ, 1.00) -> 1.00 max( NaNQ, NaNQ) -> NaNQ min( NaNQ, NaNQ) -> NaNQ ------------------------------------------------------------------------ Architecture: IBM SP2 (166 MHz); AIX 4.3.2.0 g77 -g minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, NaNQ) -> NaNQ min( 1.00, NaNQ) -> NaNQ max( NaNQ, 1.00) -> 1.00 min( NaNQ, 1.00) -> 1.00 max( NaNQ, NaNQ) -> NaNQ min( NaNQ, NaNQ) -> NaNQ ------------------------------------------------------------------------ Architecture: IBM SP2 (166 MHz); AIX 4.3.2.0 xlf -g minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, NaNQ) -> 1.00 min( 1.00, NaNQ) -> NaNQ max( NaNQ, 1.00) -> NaNQ min( NaNQ, 1.00) -> 1.00 max( NaNQ, NaNQ) -> NaNQ min( NaNQ, NaNQ) -> NaNQ ------------------------------------------------------------------------ Architecture: IBM SP2 (166 MHz); AIX 4.3.2.0 xlf90 -g -qfixed minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, NaNQ) -> 1.00 min( 1.00, NaNQ) -> NaNQ max( NaNQ, 1.00) -> NaNQ min( NaNQ, 1.00) -> 1.00 max( NaNQ, NaNQ) -> NaNQ min( NaNQ, NaNQ) -> NaNQ ------------------------------------------------------------------------ Architecture: IBM SP2 (166 MHz); AIX 4.3.2.0 xlf95 -g -qfixed minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, NaNQ) -> 1.00 min( 1.00, NaNQ) -> NaNQ max( NaNQ, 1.00) -> NaNQ min( NaNQ, 1.00) -> 1.00 max( NaNQ, NaNQ) -> NaNQ min( NaNQ, NaNQ) -> NaNQ ------------------------------------------------------------------------ Architecture: Intel Pentium III (600 MHz); GNU/Linux 2.2.17-14smp (Red Hat 6.2) f77 -g minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, nan) -> nan min( 1.00, nan) -> nan max( nan, 1.00) -> 1.00 min( nan, 1.00) -> 1.00 max( nan, nan) -> nan min( nan, nan) -> nan ------------------------------------------------------------------------ Architecture: Intel Pentium II (2 CPUs, 450 MHz); FreeBSD 4.2.0 f77 -g minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, NaN) -> NaN min( 1.00, NaN) -> NaN max( NaN, 1.00) -> 1.00 min( NaN, 1.00) -> 1.00 max( NaN, NaN) -> NaN min( NaN, NaN) -> NaN ------------------------------------------------------------------------ Architecture: Intel Pentium II (2 CPUs, 450 MHz); FreeBSD 4.2.0 g77 -g minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, NaN) -> NaN min( 1.00, NaN) -> NaN max( NaN, 1.00) -> 1.00 min( NaN, 1.00) -> 1.00 max( NaN, NaN) -> NaN min( NaN, NaN) -> NaN ------------------------------------------------------------------------ Architecture: Intel Pentium III (600 MHz); GNU/Linux 2.2.17-14smp (Red Hat 6.2) f77 -g minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, nan) -> nan min( 1.00, nan) -> nan max( nan, 1.00) -> 1.00 min( nan, 1.00) -> 1.00 max( nan, nan) -> nan min( nan, nan) -> nan ------------------------------------------------------------------------ Architecture: Intel Pentium III (600 MHz); GNU/Linux 2.2.17-14smp (Red Hat 6.2) g77 -g minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, nan) -> nan min( 1.00, nan) -> nan max( nan, 1.00) -> 1.00 min( nan, 1.00) -> 1.00 max( nan, nan) -> nan min( nan, nan) -> nan ------------------------------------------------------------------------ Architecture: Intel Pentium III (600 MHz); GNU/Linux 2.2.17-14smp (Red Hat 6.2) nagf90 -ieee=full -g minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, nan) -> nan min( 1.00, nan) -> nan max( nan, 1.00) -> 1.00 min( nan, 1.00) -> 1.00 max( nan, nan) -> nan min( nan, nan) -> nan ------------------------------------------------------------------------ Architecture: Intel Pentium III (600 MHz); GNU/Linux 2.2.17-14smp (Red Hat 6.2) nagf95 -ieee=full -g minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, nan) -> nan min( 1.00, nan) -> nan max( nan, 1.00) -> 1.00 min( nan, 1.00) -> 1.00 max( nan, nan) -> nan min( nan, nan) -> nan ------------------------------------------------------------------------ Architecture: Intel Pentium III (600 MHz); GNU/Linux 2.2.17-14smp (Red Hat 6.2) pgf77 -g minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, -nan) -> -nan min( 1.00, -nan) -> 1.00 max( -nan, 1.00) -> 1.00 min( -nan, 1.00) -> -nan max( -nan, -nan) -> -nan min( -nan, -nan) -> -nan ------------------------------------------------------------------------ Architecture: Intel Pentium III (600 MHz); GNU/Linux 2.2.17-14smp (Red Hat 6.2) pgf90 -g minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, -nan) -> 1.00 min( 1.00, -nan) -> -nan max( -nan, 1.00) -> -nan min( -nan, 1.00) -> 1.00 max( -nan, -nan) -> -nan min( -nan, -nan) -> -nan ------------------------------------------------------------------------ Architecture: Intel Pentium III (600 MHz); GNU/Linux 2.2.17-14smp (Red Hat 6.2) pghpf -g minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, -nan) -> 1.00 min( 1.00, -nan) -> -nan max( -nan, 1.00) -> -nan min( -nan, 1.00) -> 1.00 max( -nan, -nan) -> -nan min( -nan, -nan) -> -nan ------------------------------------------------------------------------ Architecture: Intel Pentium III (600 MHz); GNU/Linux 2.2.17-14smp (Red Hat 6.2) f77 -g minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, nan) -> nan min( 1.00, nan) -> nan max( nan, 1.00) -> 1.00 min( nan, 1.00) -> 1.00 max( nan, nan) -> nan min( nan, nan) -> nan ------------------------------------------------------------------------ Architecture: Intel Pentium III (600 MHz); GNU/Linux 2.2.17-14smp (Red Hat 6.2) sgif90 -g minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, NaN) -> NaN min( 1.00, NaN) -> NaN max( NaN, 1.00) -> 1.00 min( NaN, 1.00) -> 1.00 max( NaN, NaN) -> NaN min( NaN, NaN) -> NaN ------------------------------------------------------------------------ Architecture: SGI Origin/200-4; IRIX 6.5 f77 -g minmax2.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00,nan ) -> 1.00 min( 1.00,nan ) ->nan max(nan , 1.00) ->nan min(nan , 1.00) -> 1.00 max(nan ,nan ) ->nan min(nan ,nan ) ->nan ------------------------------------------------------------------------ Architecture: SGI Origin/200-4; IRIX 6.5 g77 -g minmax2.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, nan0x7ffffe00) -> nan0x7ffffe00 min( 1.00, nan0x7ffffe00) -> nan0x7ffffe00 max( nan0x7ffffe00, 1.00) -> 1.00 min( nan0x7ffffe00, 1.00) -> 1.00 max( nan0x7ffffe00, nan0x7ffffe00) -> nan0x7ffffe00 min( nan0x7ffffe00, nan0x7ffffe00) -> nan0x7ffffe00 ------------------------------------------------------------------------ Architecture: SGI Origin/200-4; IRIX 6.5 f90 -g minmax2.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, NaN) -> 1.00 min( 1.00, NaN) -> NaN max( NaN, 1.00) -> NaN min( NaN, 1.00) -> 1.00 max( NaN, NaN) -> NaN min( NaN, NaN) -> NaN ------------------------------------------------------------------------ Architecture: SGI Origin/200-4; IRIX 6.5 nagf90 -ieee=full -g minmax2.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, nan0x7ffffe00) -> nan0x7ffffe00 min( 1.00, nan0x7ffffe00) -> nan0x7ffffe00 max( nan0x7ffffe00, 1.00) -> 1.00 min( nan0x7ffffe00, 1.00) -> 1.00 max( nan0x7ffffe00, nan0x7ffffe00) -> nan0x7ffffe00 min( nan0x7ffffe00, nan0x7ffffe00) -> nan0x7ffffe00 ------------------------------------------------------------------------ Architecture: SGI Origin/200-4; IRIX 6.5 nagf95 -ieee=full -g minmax2.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, nan0x7ffffe00) -> nan0x7ffffe00 min( 1.00, nan0x7ffffe00) -> nan0x7ffffe00 max( nan0x7ffffe00, 1.00) -> 1.00 min( nan0x7ffffe00, 1.00) -> 1.00 max( nan0x7ffffe00, nan0x7ffffe00) -> nan0x7ffffe00 min( nan0x7ffffe00, nan0x7ffffe00) -> nan0x7ffffe00 ------------------------------------------------------------------------ Architecture: Sun SPARC 10/51; GNU/Linux 2.2.19-6.2.1 (Red Hat 6.2) f77 -g minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, nan) -> nan min( 1.00, nan) -> nan max( nan, 1.00) -> 1.00 min( nan, 1.00) -> 1.00 max( nan, nan) -> nan min( nan, nan) -> nan ------------------------------------------------------------------------ Architecture: Sun SPARC 10/51; GNU/Linux 2.2.19-6.2.1 (Red Hat 6.2) g77 -g minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, nan) -> nan min( 1.00, nan) -> nan max( nan, 1.00) -> 1.00 min( nan, 1.00) -> 1.00 max( nan, nan) -> nan min( nan, nan) -> nan ------------------------------------------------------------------------ Architecture: Sun Ultra Enterprise 5500; Solaris 2.7 f77 -g minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00,NaN ) ->NaN min( 1.00,NaN ) ->NaN max(NaN , 1.00) -> 1.00 min(NaN , 1.00) -> 1.00 max(NaN ,NaN ) ->NaN min(NaN ,NaN ) ->NaN ------------------------------------------------------------------------ Architecture: Sun Ultra Enterprise 5500; Solaris 2.7 g77 -g minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, NaN) -> NaN min( 1.00, NaN) -> NaN max( NaN, 1.00) -> 1.00 min( NaN, 1.00) -> 1.00 max( NaN, NaN) -> NaN min( NaN, NaN) -> NaN ------------------------------------------------------------------------ Architecture: Sun Ultra Enterprise 5500; Solaris 2.7 f90 -g -ftrap=%none minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, NaN) -> NaN min( 1.00, NaN) -> NaN max( NaN, 1.00) -> 1.00 min( NaN, 1.00) -> 1.00 max( NaN, NaN) -> NaN min( NaN, NaN) -> NaN ------------------------------------------------------------------------ Architecture: Sun Ultra Enterprise 5500; Solaris 2.7 f95 -g -ftrap=%none minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, NaN) -> NaN min( 1.00, NaN) -> NaN max( NaN, 1.00) -> 1.00 min( NaN, 1.00) -> 1.00 max( NaN, NaN) -> NaN min( NaN, NaN) -> NaN ------------------------------------------------------------------------ Architecture: Sun Ultra Enterprise 5500; Solaris 2.7 nagf90 -ieee=full -g minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, NaN) -> NaN min( 1.00, NaN) -> NaN max( NaN, 1.00) -> 1.00 min( NaN, 1.00) -> 1.00 max( NaN, NaN) -> NaN min( NaN, NaN) -> NaN ------------------------------------------------------------------------ Architecture: Sun Ultra Enterprise 5500; Solaris 2.7 nagf95 -ieee=full -g minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, NaN) -> NaN min( 1.00, NaN) -> NaN max( NaN, 1.00) -> 1.00 min( NaN, 1.00) -> 1.00 max( NaN, NaN) -> NaN min( NaN, NaN) -> NaN ------------------------------------------------------------------------ Architecture: Sun Ultra 5 (333 MHz, 128MB RAM) Solaris 2.8 f77 -g minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00,NaN ) ->NaN min( 1.00,NaN ) ->NaN max(NaN , 1.00) -> 1.00 min(NaN , 1.00) -> 1.00 max(NaN ,NaN ) ->NaN min(NaN ,NaN ) ->NaN ------------------------------------------------------------------------ Architecture: Sun Ultra 5 (333 MHz, 128MB RAM) Solaris 2.8 g77 -g minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, NaN) -> NaN min( 1.00, NaN) -> NaN max( NaN, 1.00) -> 1.00 min( NaN, 1.00) -> 1.00 max( NaN, NaN) -> NaN min( NaN, NaN) -> NaN ------------------------------------------------------------------------ Architecture: Sun Ultra 5 (333 MHz, 128MB RAM) Solaris 2.8 f90 -g -ftrap=%none minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, NaN) -> NaN min( 1.00, NaN) -> NaN max( NaN, 1.00) -> 1.00 min( NaN, 1.00) -> 1.00 max( NaN, NaN) -> NaN min( NaN, NaN) -> NaN ------------------------------------------------------------------------ Architecture: Sun Ultra 5 (333 MHz, 128MB RAM) Solaris 2.8 f95 -g -ftrap=%none minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, NaN) -> NaN min( 1.00, NaN) -> NaN max( NaN, 1.00) -> 1.00 min( NaN, 1.00) -> 1.00 max( NaN, NaN) -> NaN min( NaN, NaN) -> NaN ------------------------------------------------------------------------ Architecture: Sun Ultra 5 (333 MHz, 128MB RAM) Solaris 2.8 nagf90 -ieee=full -g minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, NaN) -> NaN min( 1.00, NaN) -> NaN max( NaN, 1.00) -> 1.00 min( NaN, 1.00) -> 1.00 max( NaN, NaN) -> NaN min( NaN, NaN) -> NaN ------------------------------------------------------------------------ Architecture: Sun Ultra 5 (333 MHz, 128MB RAM) Solaris 2.8 nagf95 -ieee=full -g minmax.f max( 1.00, 2.00) -> 2.00 min( 1.00, 2.00) -> 1.00 max( 1.00, NaN) -> NaN min( 1.00, NaN) -> NaN max( NaN, 1.00) -> 1.00 min( NaN, 1.00) -> 1.00 max( NaN, NaN) -> NaN min( NaN, NaN) -> NaN ------------------------------------------------------------------------