LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
test_zminMax.f
Go to the documentation of this file.
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, nfailingtests, ntests
48 double precision ainf, anan, ov, r, x(n), y(n)
49*
50* .. Intrinsic Functions ..
51 intrinsic huge, min, max
52
53*
54* .. Initialize error counts ..
55 nfailingtests = 0
56 ntests = 0
57*
58* .. Inf and NaN entries ..
59 ov = huge(0.0d0)
60 ainf = ov * 2
61 anan = ainf / ainf
62 x = (/ -ainf, zero, -ainf, zero, ainf, ainf, zero, anan /)
63 y = (/ zero, ainf, ainf, -ainf, zero, -ainf, anan, zero /)
64
65*
66* .. Tests ..
67*
68 do 10 i = 1, 3
69 ntests = ntests + 2
70 r = min( x(i), y(i) )
71 if( r .ne. x(i) ) then
72 nfailingtests = nfailingtests + 1
73 WRITE( *, fmt = 9998 ) 'i',i, 'MIN', x(i), y(i), r
74 endif
75 r = max( x(i), y(i) )
76 if( r .ne. y(i) ) then
77 nfailingtests = nfailingtests + 1
78 WRITE( *, fmt = 9998 ) 'i',i, 'MAX', x(i), y(i), r
79 endif
80 10 continue
81 do 20 i = 4, 6
82 ntests = ntests + 2
83 r = min( x(i), y(i) )
84 if( r .ne. y(i) ) then
85 nfailingtests = nfailingtests + 1
86 WRITE( *, fmt = 9998 ) 'i',i, 'MIN', x(i), y(i), r
87 endif
88 r = max( x(i), y(i) )
89 if( r .ne. x(i) ) then
90 nfailingtests = nfailingtests + 1
91 WRITE( *, fmt = 9998 ) 'i',i, 'MAX', x(i), y(i), r
92 endif
93 20 continue
94 do 30 i = 7, 8
95 ntests = ntests + 2
96 r = min( x(i), y(i) )
97 if( r .eq. r ) then
98 nfailingtests = nfailingtests + 1
99 WRITE( *, fmt = 9998 ) 'i',i, 'MIN', x(i), y(i), r
100 endif
101 r = max( x(i), y(i) )
102 if( r .eq. r ) then
103 nfailingtests = nfailingtests + 1
104 WRITE( *, fmt = 9998 ) 'i',i, 'MAX', x(i), y(i), r
105 endif
106 30 continue
107*
108 if( nfailingtests .gt. 0 ) then
109 print *, "# ", ntests-nfailingtests, " tests out of ", ntests,
110 $ " pass for intrinsic MIN and MAX,", nfailingtests," fail."
111 else
112 print *, "# All tests pass for intrinsic MIN and MAX."
113 endif
114*
115* .. Formats ..
116 9998 FORMAT( '[',a1,i1, '] ', a3, '(', f5.0, ',', f5.0, ') = ', f5.0 )
117*
118* End of zmul
119*
120 END
program zmul
zmul tests the robustness and precision of the double complex multiplication