LAPACK  3.11.0
LAPACK: Linear Algebra PACKage
test_zminMax.f
1 *> \brief zminMax tests the robustness and precision of the double-valued intrinsic operators MIN and MAX
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 * Authors:
9 * ========
10 *
11 *> \author Weslley S. Pereira, University of Colorado Denver, U.S.
12 *
13 *> \verbatim
14 *>
15 *> Tests with pairs of numbers (x,y):
16 *> Inf inputs where x < y:
17 *> (1) (-Inf, 0)
18 *> (2) ( 0 , Inf)
19 *> (3) (-Inf, Inf)
20 *> Inf inputs where x > y:
21 *> (4) ( 0 ,-Inf)
22 *> (5) ( Inf, 0)
23 *> (6) ( Inf,-Inf)
24 *> NaN inputs to test NaN propagation:
25 *> (7) ( 0 , NaN)
26 *> (8) ( NaN, 0)
27 *> The program tests MIN(x,y) and MAX(x,y) for every pair
28 *>
29 *> \endverbatim
30 *
31 *> \ingroup auxOTHERauxiliary
32 *
33 * =====================================================================
34  program zmul
35 *
36 * -- LAPACK test routine --
37 * Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
38 
39 * ..
40 * .. Parameters ..
41  integer n
42  parameter( n = 8 )
43  double precision zero
44  parameter( zero = 0.0d0 )
45 * ..
46 * .. Local Variables ..
47  integer i
48  double precision ainf, anan, ov, r, x(n), y(n)
49 *
50 * .. Intrinsic Functions ..
51  intrinsic huge, min, max
52 
53 *
54 * .. Inf and NaN entries ..
55  ov = huge(0.0d0)
56  ainf = ov * 2
57  anan = ainf / ainf
58  x = (/ -ainf, zero, -ainf, zero, ainf, ainf, zero, anan /)
59  y = (/ zero, ainf, ainf, -ainf, zero, -ainf, anan, zero /)
60 
61 *
62 * .. Tests ..
63 *
64  do 10 i = 1, 3
65  r = min( x(i), y(i) )
66  if( r .ne. x(i) ) then
67  WRITE( *, fmt = 9998 ) 'i',i, 'MIN', x(i), y(i), r
68  endif
69  r = max( x(i), y(i) )
70  if( r .ne. y(i) ) then
71  WRITE( *, fmt = 9998 ) 'i',i, 'MAX', x(i), y(i), r
72  endif
73  10 continue
74  do 20 i = 4, 6
75  r = min( x(i), y(i) )
76  if( r .ne. y(i) ) then
77  WRITE( *, fmt = 9998 ) 'i',i, 'MIN', x(i), y(i), r
78  endif
79  r = max( x(i), y(i) )
80  if( r .ne. x(i) ) then
81  WRITE( *, fmt = 9998 ) 'i',i, 'MAX', x(i), y(i), r
82  endif
83  20 continue
84  do 30 i = 7, 8
85  r = min( x(i), y(i) )
86  if( r .eq. r ) then
87  WRITE( *, fmt = 9998 ) 'i',i, 'MIN', x(i), y(i), r
88  endif
89  r = max( x(i), y(i) )
90  if( r .eq. r ) then
91  WRITE( *, fmt = 9998 ) 'i',i, 'MAX', x(i), y(i), r
92  endif
93  30 continue
94 *
95 * .. Formats ..
96  9998 FORMAT( '[',a1,i1, '] ', a3, '(', f5.0, ',', f5.0, ') = ', f5.0 )
97 *
98 * End of zmul
99 *
100  END