1 |
#!/bin/sh |
#!/bin/sh |
2 |
|
|
|
similar() |
|
|
{ |
|
|
# similar digits a b |
|
|
# |
|
|
# compare the floating point number a and b and successively reduced |
|
|
# truncation until a match is found |
|
|
for digits in 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 |
|
|
do |
|
|
a=`printf '%22.'$digits'e\n' $1` |
|
|
b=`printf '%22.'$digits'e\n' $2` |
|
|
if [ $a = $b ]; then |
|
|
if [ $verbose -gt 1 ]; then |
|
|
echo $1 $2 $a 1>&2 |
|
|
fi |
|
|
break |
|
|
fi |
|
|
done |
|
|
return $digits |
|
|
} |
|
|
|
|
3 |
compare_lines() |
compare_lines() |
4 |
{ |
{ |
|
# compare_lines digits < file |
|
|
# |
|
|
# read each line of file and test the 2nd and 3rd column values for |
|
|
# similarity based on the function similar() |
|
|
worst_so_far=$1 |
|
|
while read linenum a b |
|
|
do |
|
|
if [ $debug -gt 0 ]; then |
|
|
echo compare_lines: similar a=$a b=$b 1>&2 |
|
|
fi |
|
|
similar $a $b |
|
|
digits=$? |
|
|
if [ $digits -lt $worst_so_far ]; then |
|
|
worst_so_far=$digits |
|
|
fi |
|
|
done |
|
|
if [ $debug -gt 0 ]; then |
|
|
echo compare_lines: worst_so_far=$worst_so_far 1>&2 |
|
|
fi |
|
|
return $worst_so_far |
|
|
} |
|
|
|
|
|
compare_lines2() |
|
|
{ |
|
5 |
# use codelet to compare lines |
# use codelet to compare lines |
6 |
|
if [ $verbose -gt 1 ]; then |
7 |
|
cat tmp3.txt 1>&2 |
8 |
|
fi |
9 |
return `./a.out < tmp3.txt` |
return `./a.out < tmp3.txt` |
10 |
} |
} |
11 |
|
|
36 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then |
37 |
echo testoutput_for_prop: compare_lines 1>&2 |
echo testoutput_for_prop: compare_lines 1>&2 |
38 |
fi |
fi |
39 |
#compare_lines 99 < tmp3.txt |
compare_lines |
|
compare_lines2 |
|
40 |
digits_of_similarity=$? |
digits_of_similarity=$? |
41 |
if [ $digits_of_similarity -eq 99 ]; then |
if [ $digits_of_similarity -eq 99 ]; then |
42 |
if [ $verbose -gt 0 ]; then |
if [ $verbose -gt 0 ]; then |
122 |
( cd $1; |
( cd $1; |
123 |
if [ $quick -eq 0 -o ! -r Makefile ]; then |
if [ $quick -eq 0 -o ! -r Makefile ]; then |
124 |
printf 'genmake ... ' 1>&2 |
printf 'genmake ... ' 1>&2 |
125 |
../../../tools/genmake -mods=../code > make.log 2>&1 |
../../../tools/genmake -ieee -mods=../code > make.log 2>&1 |
126 |
if [ $? -ne 0 ]; then |
if [ $? -ne 0 ]; then |
127 |
tail make.log |
tail make.log |
128 |
echo makemodel: genmake failed 1>&2 |
echo makemodel: genmake failed 1>&2 |
205 |
best=-16 |
best=-16 |
206 |
99 read(*,*,end=70,err=60) linnum,a,b |
99 read(*,*,end=70,err=60) linnum,a,b |
207 |
diff=0.5*(abs(a)+abs(b)) |
diff=0.5*(abs(a)+abs(b)) |
208 |
if (diff.gt.0.) then |
c print *,a,b,diff,abs(a-b)/diff |
209 |
|
if (diff.gt.1.e-12) then |
210 |
diff=abs(a-b)/diff |
diff=abs(a-b)/diff |
211 |
if (diff.gt.0.) then |
if (diff.gt.0.) then |
212 |
c print *,int(log10(diff)),diff |
c print *,int(log10(diff)),diff |
213 |
linnum=int(log10(diff)) |
linnum=int(log10(diff)) |
214 |
best=max(best,linnum) |
best=max(best,linnum) |
|
c else |
|
|
c print *,-16 |
|
215 |
endif |
endif |
216 |
c else |
else |
217 |
c diff=0. |
if (best.eq.-16.and.diff.ne.0.) best=-22 |
|
c print *,-16 |
|
218 |
endif |
endif |
219 |
goto 99 |
goto 99 |
220 |
60 stop 'cmpnum: An error occured reading a,b' |
60 stop 'cmpnum: An error occured reading a,b' |
302 |
|
|
303 |
createcodelet |
createcodelet |
304 |
|
|
305 |
if [ $testmore -eq 0 ]; then |
if [ $testmore -gt 0 ]; then |
306 |
cat << EOF > summary.txt |
cat << EOF > summary.txt |
307 |
T S U V |
T S U V |
308 |
C D M c m s m s m s m s |
C D M c m s m s m s m s |