65 parameter( debug = .false. )
67 parameter( n = 4, nnan = 3, ninf = 5 )
68 double precision threefourth, fivefourth
69 parameter( threefourth = 3.0d0 / 4,
70 $ fivefourth = 5.0d0 / 4 )
71 double complex czero, cone
72 parameter( czero = dcmplx( 0.0d0, 0.0d0 ),
73 $ cone = dcmplx( 1.0d0, 0.0d0 ) )
76 integer i, min, max, m,
77 $ subnormaltreatedas0, caseafails, casebfails,
78 $ casecfails, casedfails, caseefails, caseffails
79 double precision x( n ), ainf, anan, b,
80 $ eps, bluemin, bluemax, ov, xj, stepx(n), limx(n)
81 double complex y, y2, r, cinf( ninf ), cnan( nnan )
84 intrinsic dconjg, dble, radix, ceiling, tiny, digits,
85 $ maxexponent, minexponent, floor, huge, dcmplx,
90 subnormaltreatedas0 = 0
99 min = minexponent(0.0d0)
100 max = maxexponent(0.0d0)
102 b = dble(radix(0.0d0))
104 bluemin = b**ceiling( (min - 1) * 0.5d0 )
105 bluemax = b**floor( (max - m + 1) * 0.5d0 )
109 x(1) = tiny(0.0d0) * b**( dble(1-m) )
112 x(4) = b**( dble(max-1) )
128 cinf(1) = dcmplx( ainf, 0.0d0 )
129 cinf(2) = dcmplx(-ainf, 0.0d0 )
130 cinf(3) = dcmplx( 0.0d0, ainf )
131 cinf(4) = dcmplx( 0.0d0,-ainf )
132 cinf(5) = dcmplx( ainf, ainf )
136 cnan(1) = dcmplx( anan, 0.0d0 )
137 cnan(2) = dcmplx( 0.0d0, anan )
138 cnan(3) = dcmplx( anan, anan )
145 print *,
'# Blue min constant :=', bluemin
146 print *,
'# Blue max constant :=', bluemax
150 if( xj .eq. 0.0d0 )
then 151 subnormaltreatedas0 = subnormaltreatedas0 + 1
152 if( debug .or. subnormaltreatedas0 .eq. 1 )
then 153 print *,
"!! fl( subnormal ) may be 0" 158 if( xj .eq. 0.0d0 )
then 159 subnormaltreatedas0 = subnormaltreatedas0 + 1
160 if( debug .or. subnormaltreatedas0 .eq. 1 )
then 161 print *,
"!! fl( subnormal ) may be 0" 170 if( xj .eq. 0.0d0 )
then 171 subnormaltreatedas0 = subnormaltreatedas0 + 1
172 if( debug .or. subnormaltreatedas0 .eq. 1 )
then 173 print *,
"!! [a] fl( subnormal ) may be 0" 176 do while( xj .ne. limx(i) )
177 y = dcmplx( xj, 0.0d0 )
179 if( r .ne. 1.0d0 )
then 180 caseafails = caseafails + 1
181 if( caseafails .eq. 1 )
then 182 print *,
"!! Some (x+0*I)/(x+0*I) differ from 1" 184 WRITE( 0, fmt = 9999 )
'a',i, xj,
185 $
'(x+0*I)/(x+0*I)', r, 1.0d0
195 if( xj .eq. 0.0d0 )
then 196 subnormaltreatedas0 = subnormaltreatedas0 + 1
197 if( debug .or. subnormaltreatedas0 .eq. 1 )
then 198 print *,
"!! [b] fl( subnormal ) may be 0" 201 do while( xj .ne. limx(i) )
202 y = dcmplx( 0.0d0, xj )
204 if( r .ne. 1.0d0 )
then 205 casebfails = casebfails + 1
206 if( casebfails .eq. 1 )
then 207 print *,
"!! Some (0+x*I)/(0+x*I) differ from 1" 209 WRITE( 0, fmt = 9999 )
'b',i, xj,
210 $
'(0+x*I)/(0+x*I)', r, 1.0d0
220 if( xj .eq. 0.0d0 )
then 221 subnormaltreatedas0 = subnormaltreatedas0 + 1
222 if( debug .or. subnormaltreatedas0 .eq. 1 )
then 223 print *,
"!! [c] fl( subnormal ) may be 0" 226 do while( xj .ne. limx(i) )
229 if( r .ne. 1.0d0 )
then 230 casecfails = casecfails + 1
231 if( casecfails .eq. 1 )
then 232 print *,
"!! Some (x+x*I)/(x+x*I) differ from 1" 234 WRITE( 0, fmt = 9999 )
'c',i, xj,
235 $
'(x+x*I)/(x+x*I)', r, 1.0d0
245 if( xj .eq. 0.0d0 )
then 246 subnormaltreatedas0 = subnormaltreatedas0 + 1
247 if( debug .or. subnormaltreatedas0 .eq. 1 )
then 248 print *,
"!! [d] fl( subnormal ) may be 0" 251 do while( xj .ne. limx(i) )
252 y = dcmplx( 0.0d0, xj )
253 y2 = dcmplx( xj, 0.0d0 )
255 if( r .ne. dcmplx(0.0d0,1.0d0) )
then 256 casedfails = casedfails + 1
257 if( casedfails .eq. 1 )
then 258 print *,
"!! Some (0+x*I)/(x+0*I) differ from I" 260 WRITE( 0, fmt = 9999 )
'd',i, xj,
'(0+x*I)/(x+0*I)',
261 $ r, dcmplx(0.0d0,1.0d0)
271 if( xj .eq. 0.0d0 )
then 272 subnormaltreatedas0 = subnormaltreatedas0 + 1
273 if( debug .or. subnormaltreatedas0 .eq. 1 )
then 274 print *,
"!! [e] fl( subnormal ) may be 0" 277 do while( xj .ne. limx(i) )
278 y = dcmplx( 0.0d0, xj )
279 y2 = dcmplx( xj, 0.0d0 )
281 if( r .ne. dcmplx(0.0d0,-1.0d0) )
then 282 caseefails = caseefails + 1
283 if( caseefails .eq. 1 )
then 284 print *,
"!! Some (x+0*I)/(0+x*I) differ from -I" 286 WRITE( 0, fmt = 9999 )
'e',i, xj,
'(x+0*I)/(0+x*I)',
287 $ r, dcmplx(0.0d0,-1.0d0)
297 if( xj .eq. 0.0d0 )
then 298 subnormaltreatedas0 = subnormaltreatedas0 + 1
299 if( debug .or. subnormaltreatedas0 .eq. 1 )
then 300 print *,
"!! [f] fl( subnormal ) may be 0" 303 do while( xj .ne. limx(i) )
306 if( r .ne. dcmplx(0.0d0,1.0d0) )
then 307 caseffails = caseffails + 1
308 if( caseffails .eq. 1 )
then 309 print *,
"!! Some (x+x*I)/(x-x*I) differ from I" 311 WRITE( 0, fmt = 9999 )
'f',i, xj,
'(x+x*I)/(x-x*I)',
312 $ r, dcmplx(0.0d0,1.0d0)
323 if( (r .ne. czero) .and. (r .eq. r) )
then 324 WRITE( *, fmt = 9998 )
'ia',i, czero, y, r,
'NaN and 0' 327 if( (r .ne. czero) .and. (r .eq. r) )
then 328 WRITE( *, fmt = 9998 )
'ib',i, cone, y, r,
'NaN and 0' 332 WRITE( *, fmt = 9998 )
'ic',i, y, y, r,
'NaN' 341 WRITE( *, fmt = 9998 )
'na',i, czero, y, r,
'NaN' 345 WRITE( *, fmt = 9998 )
'nb',i, cone, y, r,
'NaN' 349 WRITE( *, fmt = 9998 )
'nc',i, y, y, r,
'NaN' 354 if( (caseafails .gt. 0) .or. (casebfails .gt. 0) .or.
355 $ (casecfails .gt. 0) .or. (casedfails .gt. 0) .or.
356 $ (caseefails .gt. 0) .or. (caseffails .gt. 0) )
357 $ print *,
"# Please check the failed divisions in [stderr]" 360 9998
FORMAT(
'[',a2,i1,
'] ', (es24.16e3,sp,es24.16e3,
"*I"),
' * ',
361 $ (es24.16e3,sp,es24.16e3,
"*I"),
' = ',
362 $ (es24.16e3,sp,es24.16e3,
"*I"),
' differs from ', a10 )
364 9999
FORMAT(
'[',a2,i1,
'] X = ', es24.16e3,
' : ', a15,
' = ',
365 $ (es24.16e3,sp,es24.16e3,
"*I"),
' differs from ',
366 $ (es24.16e3,sp,es24.16e3,
"*I") )