1 |
jmc |
1.1 |
C $Header: $ |
2 |
|
|
C $Name: $ |
3 |
|
|
program cmpnum |
4 |
|
|
implicit none |
5 |
|
|
real*8 a,b,diff |
6 |
|
|
integer linnum,tmp,best |
7 |
|
|
open(17,file='cmpnum.log',status='unknown') |
8 |
|
|
best=-22 |
9 |
|
|
99 read(*,*,end=70,err=60) linnum,a,b |
10 |
|
|
diff=0.5*(abs(a)+abs(b)) |
11 |
|
|
c print *,a,b,diff,abs(a-b)/diff |
12 |
|
|
c if (diff.gt.1.e-12) then |
13 |
|
|
if (diff.gt.0.) then |
14 |
|
|
diff=abs(a-b)/diff |
15 |
|
|
if (diff.gt.0.) then |
16 |
|
|
c print *,int(log10(diff)),diff |
17 |
|
|
tmp=nint(log10(diff)) |
18 |
|
|
else |
19 |
|
|
tmp=-16; |
20 |
|
|
endif |
21 |
|
|
best=max(best,tmp) |
22 |
|
|
else |
23 |
|
|
tmp =-22 |
24 |
|
|
endif |
25 |
|
|
write(17,'(I4,1P2E22.14,A,I4)') linnum,a,b,' :',-tmp |
26 |
|
|
goto 99 |
27 |
|
|
60 stop 'cmpnum: An error occured reading a,b' |
28 |
|
|
70 continue |
29 |
|
|
close(17) |
30 |
|
|
print *,-best |
31 |
|
|
end |