home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
waithang.zip
/
MAT015.CFL
next >
Wrap
Text File
|
1998-07-17
|
7KB
|
137 lines
The Modular OS/2 compatability test system hang running MAT015
MAT015 - Summary of code flow
The test is a small VDM app that does sin and power series sin approximation
of a couple of basic numbers. The app is failing while calculating the
power series sin approximation of -1. The code reads as follows:
double mysinh(double x)
{
int i, j;
double sn, term, magn;
term = x;
sn = term;
for(i=1;i<500;++i)
{
j=2*i;
term=term/((double) j * (j+1));
term*=x*x;
magn=sn;
sn+=term;
if(fabs(term)<(magn*1.e-17)
break;
}
return(sn);
}
I have identified the line "term*=x*x;" as the problem spot.
after going through the for loop hex 55 times term has become a very
small negative number. The calculation of this line yelds a positive one.
On a working machine it yelds a really small negative number.
THe following is the debug log of the problem machine for the identified
line of C code. Keep in mind that x=-1.
** what is term at this time **
--dd bp-18 l2
10ec:00001500 373a92f4 80009455 ** notice the sign bit indicates negative**
*** don't forgit you have to word flip this to 80009455373a92f4 ***
--p
*** load up npx with -1******
eax=000000ab ebx=000014f2 ecx=000003b3 edx=00000630 esi=00000395 edi=000014fc
eip=000003fc esp=000014ee ebp=00001518 iopl=3 -- vm -- nv up ei pl nz na po nc
cs=0aaf ss=10ec ds=10ec es=10ec fs=0000 gs=0000 cr2=0001428e cr3=001c9000
0aaf:000003fc dd4604 fld qword ptr ìbp+04┘ ss:151c=bff0000000000000
--p
eax=000000ab ebx=000014f2 ecx=000003b3 edx=00000630 esi=00000395 edi=000014fc
eip=000003ff esp=000014ee ebp=00001518 iopl=3 -- vm -- nv up ei pl nz na po nc
cs=0aaf ss=10ec ds=10ec es=10ec fs=0000 gs=0000 cr2=0001428e cr3=001c9000
0aaf:000003ff 90 nop
--p
**** multiply top of npx stack with a -1 ************
eax=000000ab ebx=000014f2 ecx=000003b3 edx=00000630 esi=00000395 edi=000014fc
eip=00000400 esp=000014ee ebp=00001518 iopl=3 -- vm -- nv up ei pl nz na po nc
cs=0aaf ss=10ec ds=10ec es=10ec fs=0000 gs=0000 cr2=0001428e cr3=001c9000
0aaf:00000400 dc4e04 fmul qword ptr ìbp+04┘ ss:151c=bff0000000000000
--p
eax=000000ab ebx=000014f2 ecx=000003b3 edx=00000630 esi=00000395 edi=000014fc
eip=00000403 esp=000014ee ebp=00001518 iopl=3 -- vm -- nv up ei pl nz na po nc
cs=0aaf ss=10ec ds=10ec es=10ec fs=0000 gs=0000 cr2=0001428e cr3=001c9000
0aaf:00000403 90 nop
--p
*** multiply top of stack with term ( a very small negative number ) *****
eax=000000ab ebx=000014f2 ecx=000003b3 edx=00000630 esi=00000395 edi=000014fc
eip=00000404 esp=000014ee ebp=00001518 iopl=3 -- vm -- nv up ei pl nz na po nc
cs=0aaf ss=10ec ds=10ec es=10ec fs=0000 gs=0000 cr2=0001428e cr3=001c9000
0aaf:00000404 dc4ee8 fmul qword ptr ìbp-18┘ ss:1500=80009455373a92f4
--p
eax=000000ab ebx=000014f2 ecx=000003b3 edx=00000630 esi=00000395 edi=000014fc
eip=00000407 esp=000014ee ebp=00001518 iopl=3 -- vm -- nv up ei pl nz na po nc
cs=0aaf ss=10ec ds=10ec es=10ec fs=0000 gs=0000 cr2=0001428e cr3=001c9000
0aaf:00000407 90 nop
--p
*** stash result into term ******
eax=000000ab ebx=000014f2 ecx=000003b3 edx=00000630 esi=00000395 edi=000014fc
eip=00000408 esp=000014ee ebp=00001518 iopl=3 -- vm -- nv up ei pl nz na po nc
cs=0aaf ss=10ec ds=10ec es=10ec fs=0000 gs=0000 cr2=0001428e cr3=001c9000
0aaf:00000408 dd5ee8 fstp qword ptr ìbp-18┘ ss:1500=80009455373a92f4
--p
*** what is term now ?????????????*********
--dd bp-18 l2
10ec:00001500 00000000 3ff00000 *** it's a positive 1 *****
The following is the same stuff for a good machine
The following is the same stuff for a good machine
The following is the same stuff for a good machine
The following is the same stuff for a good machine
The following is the same stuff for a good machine
The following is the same stuff for a good machine
--bp r
eax=000000ab ebx=000014f2 ecx=000003b3 edx=00000630 esi=00000395 edi=000014fc
eip=000003fc esp=000014ee ebp=00001518 iopl=3 -- vm -- nv up ei pl nz na po nc
cs=0ab0 ss=10ed ds=10ed es=10ed fs=0000 gs=0000 cr2=01330ffe cr3=001d2000
0ab0:000003fc dd4604 fld qword ptr ìbp+04┘ ss:151c=bff0000000000000
--p
eax=000000ab ebx=000014f2 ecx=000003b3 edx=00000630 esi=00000395 edi=000014fc
eip=000003ff esp=000014ee ebp=00001518 iopl=3 -- vm -- nv up ei pl nz na po nc
cs=0ab0 ss=10ed ds=10ed es=10ed fs=0000 gs=0000 cr2=01330ffe cr3=001d2000
0ab0:000003ff 90 nop
--p
eax=000000ab ebx=000014f2 ecx=000003b3 edx=00000630 esi=00000395 edi=000014fc
eip=00000400 esp=000014ee ebp=00001518 iopl=3 -- vm -- nv up ei pl nz na po nc
cs=0ab0 ss=10ed ds=10ed es=10ed fs=0000 gs=0000 cr2=01330ffe cr3=001d2000
0ab0:00000400 dc4e04 fmul qword ptr ìbp+04┘ ss:151c=bff0000000000000
--p
eax=000000ab ebx=000014f2 ecx=000003b3 edx=00000630 esi=00000395 edi=000014fc
eip=00000403 esp=000014ee ebp=00001518 iopl=3 -- vm -- nv up ei pl nz na po nc
cs=0ab0 ss=10ed ds=10ed es=10ed fs=0000 gs=0000 cr2=01330ffe cr3=001d2000
0ab0:00000403 90 nop
--p
eax=000000ab ebx=000014f2 ecx=000003b3 edx=00000630 esi=00000395 edi=000014fc
eip=00000404 esp=000014ee ebp=00001518 iopl=3 -- vm -- nv up ei pl nz na po nc
cs=0ab0 ss=10ed ds=10ed es=10ed fs=0000 gs=0000 cr2=01330ffe cr3=001d2000
0ab0:00000404 dc4ee8 fmul qword ptr ìbp-18┘ ss:1500=80009455373a92f4
--p
eax=000000ab ebx=000014f2 ecx=000003b3 edx=00000630 esi=00000395 edi=000014fc
eip=00000407 esp=000014ee ebp=00001518 iopl=3 -- vm -- nv up ei pl nz na po nc
cs=0ab0 ss=10ed ds=10ed es=10ed fs=0000 gs=0000 cr2=01330ffe cr3=001d2000
0ab0:00000407 90 nop
--p
eax=000000ab ebx=000014f2 ecx=000003b3 edx=00000630 esi=00000395 edi=000014fc
eip=00000408 esp=000014ee ebp=00001518 iopl=3 -- vm -- nv up ei pl nz na po nc
cs=0ab0 ss=10ed ds=10ed es=10ed fs=0000 gs=0000 cr2=01330ffe cr3=001d2000
0ab0:00000408 dd5ee8 fstp qword ptr ìbp-18┘ ss:1500=80009455373a92f4
--p
***** lets look at term for this machine *******
--dd bp-18 l2
10ed:00001500 373a92f4 80009455 *** not is a small negative number *****
--g
**** after running througth the loop many times term get to be this*****
*** and doesn't change or ever become +1 ********
10ed:00001500 00000000 80000000
========================================================================