Ewald 1D in 3D: jdu spát
[qpms.git] / amos / zuchk.f
blobd15dc841ed36b76bf0fdb3e843eb15ddf2ec9e77
1 SUBROUTINE ZUCHK(YR, YI, NZ, ASCLE, TOL)
2 C***BEGIN PROLOGUE ZUCHK
3 C***REFER TO ZSERI,ZUOIK,ZUNK1,ZUNK2,ZUNI1,ZUNI2,ZKSCL
5 C Y ENTERS AS A SCALED QUANTITY WHOSE MAGNITUDE IS GREATER THAN
6 C EXP(-ALIM)=ASCLE=1.0E+3*D1MACH(1)/TOL. THE TEST IS MADE TO SEE
7 C IF THE MAGNITUDE OF THE REAL OR IMAGINARY PART WOULD UNDERFLOW
8 C WHEN Y IS SCALED (BY TOL) TO ITS PROPER VALUE. Y IS ACCEPTED
9 C IF THE UNDERFLOW IS AT LEAST ONE PRECISION BELOW THE MAGNITUDE
10 C OF THE LARGEST COMPONENT; OTHERWISE THE PHASE ANGLE DOES NOT HAVE
11 C ABSOLUTE ACCURACY AND AN UNDERFLOW IS ASSUMED.
13 C***ROUTINES CALLED (NONE)
14 C***END PROLOGUE ZUCHK
16 C COMPLEX Y
17 DOUBLE PRECISION ASCLE, SS, ST, TOL, WR, WI, YR, YI
18 INTEGER NZ
19 NZ = 0
20 WR = DABS(YR)
21 WI = DABS(YI)
22 ST = DMIN1(WR,WI)
23 IF (ST.GT.ASCLE) RETURN
24 SS = DMAX1(WR,WI)
25 ST = ST/TOL
26 IF (SS.LT.ST) NZ = 1
27 RETURN
28 END