home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / waithang.zip / MAT015.CFL next >
Text File  |  1998-07-17  |  7KB  |  137 lines

  1. The Modular OS/2 compatability test system hang running MAT015
  2.  
  3. MAT015 - Summary of code flow
  4.  
  5.  The test is a small VDM app that does sin and power series sin approximation
  6.  of a couple of basic numbers. The app is failing while calculating the
  7.  power series sin approximation of -1. The code reads as follows:
  8.  
  9.  double mysinh(double x)
  10.  {
  11.  int i, j;
  12.  double sn, term, magn;
  13.  term = x;
  14.  sn = term;
  15.  for(i=1;i<500;++i)
  16.    {
  17.    j=2*i;
  18.    term=term/((double) j * (j+1));
  19.    term*=x*x;
  20.    magn=sn;
  21.    sn+=term;
  22.    if(fabs(term)<(magn*1.e-17)
  23.     break;
  24.    }
  25.    return(sn);
  26.  }
  27.  
  28.  
  29.  I have identified the line "term*=x*x;" as the problem spot.
  30.  after going through the for loop hex 55 times term has become a very
  31.  small negative number. The calculation of this line yelds a positive one.
  32.  On a working machine it yelds a really small negative number.
  33.  THe following is the debug log of the problem machine for the identified
  34.  line of C code. Keep in mind that x=-1.
  35.  
  36.  ** what is term at this time **
  37.  --dd bp-18 l2
  38.  10ec:00001500  373a92f4 80009455  ** notice the sign bit indicates negative**
  39.  *** don't forgit you have to word flip this to 80009455373a92f4 ***
  40.  --p
  41.  *** load up npx with -1******
  42.  eax=000000ab ebx=000014f2 ecx=000003b3 edx=00000630 esi=00000395 edi=000014fc
  43.  eip=000003fc esp=000014ee ebp=00001518 iopl=3 -- vm -- nv up ei pl nz na po nc
  44.  cs=0aaf ss=10ec ds=10ec es=10ec fs=0000 gs=0000  cr2=0001428e  cr3=001c9000
  45.  0aaf:000003fc dd4604         fld     qword ptr ìbp+04┘ ss:151c=bff0000000000000
  46.  --p
  47.  eax=000000ab ebx=000014f2 ecx=000003b3 edx=00000630 esi=00000395 edi=000014fc
  48.  eip=000003ff esp=000014ee ebp=00001518 iopl=3 -- vm -- nv up ei pl nz na po nc
  49.  cs=0aaf ss=10ec ds=10ec es=10ec fs=0000 gs=0000  cr2=0001428e  cr3=001c9000
  50.  0aaf:000003ff 90             nop
  51.  --p
  52.  **** multiply top of npx stack with a -1 ************
  53.  eax=000000ab ebx=000014f2 ecx=000003b3 edx=00000630 esi=00000395 edi=000014fc
  54.  eip=00000400 esp=000014ee ebp=00001518 iopl=3 -- vm -- nv up ei pl nz na po nc
  55.  cs=0aaf ss=10ec ds=10ec es=10ec fs=0000 gs=0000  cr2=0001428e  cr3=001c9000
  56.  0aaf:00000400 dc4e04         fmul    qword ptr ìbp+04┘ ss:151c=bff0000000000000
  57.  --p
  58.  eax=000000ab ebx=000014f2 ecx=000003b3 edx=00000630 esi=00000395 edi=000014fc
  59.  eip=00000403 esp=000014ee ebp=00001518 iopl=3 -- vm -- nv up ei pl nz na po nc
  60.  cs=0aaf ss=10ec ds=10ec es=10ec fs=0000 gs=0000  cr2=0001428e  cr3=001c9000
  61.  0aaf:00000403 90             nop
  62.  --p
  63.  *** multiply top of stack with term ( a very small negative number ) *****
  64.  eax=000000ab ebx=000014f2 ecx=000003b3 edx=00000630 esi=00000395 edi=000014fc
  65.  eip=00000404 esp=000014ee ebp=00001518 iopl=3 -- vm -- nv up ei pl nz na po nc
  66.  cs=0aaf ss=10ec ds=10ec es=10ec fs=0000 gs=0000  cr2=0001428e  cr3=001c9000
  67.  0aaf:00000404 dc4ee8         fmul    qword ptr ìbp-18┘ ss:1500=80009455373a92f4
  68.  --p
  69.  eax=000000ab ebx=000014f2 ecx=000003b3 edx=00000630 esi=00000395 edi=000014fc
  70.  eip=00000407 esp=000014ee ebp=00001518 iopl=3 -- vm -- nv up ei pl nz na po nc
  71.  cs=0aaf ss=10ec ds=10ec es=10ec fs=0000 gs=0000  cr2=0001428e  cr3=001c9000
  72.  0aaf:00000407 90             nop
  73.  --p
  74.  *** stash result into term ******
  75.  eax=000000ab ebx=000014f2 ecx=000003b3 edx=00000630 esi=00000395 edi=000014fc
  76.  eip=00000408 esp=000014ee ebp=00001518 iopl=3 -- vm -- nv up ei pl nz na po nc
  77.  cs=0aaf ss=10ec ds=10ec es=10ec fs=0000 gs=0000  cr2=0001428e  cr3=001c9000
  78.  0aaf:00000408 dd5ee8         fstp    qword ptr ìbp-18┘ ss:1500=80009455373a92f4
  79.  --p
  80.  *** what is term now ?????????????*********
  81.  --dd bp-18 l2
  82.  10ec:00001500  00000000 3ff00000  *** it's a positive 1 *****
  83.  
  84.  
  85.  The following is the same stuff for a good machine
  86.  The following is the same stuff for a good machine
  87.  The following is the same stuff for a good machine
  88.  The following is the same stuff for a good machine
  89.  The following is the same stuff for a good machine
  90.  The following is the same stuff for a good machine
  91.  
  92.  --bp r
  93.  eax=000000ab ebx=000014f2 ecx=000003b3 edx=00000630 esi=00000395 edi=000014fc
  94.  eip=000003fc esp=000014ee ebp=00001518 iopl=3 -- vm -- nv up ei pl nz na po nc
  95.  cs=0ab0 ss=10ed ds=10ed es=10ed fs=0000 gs=0000  cr2=01330ffe  cr3=001d2000
  96.  0ab0:000003fc dd4604         fld     qword ptr ìbp+04┘ ss:151c=bff0000000000000
  97.  --p
  98.  eax=000000ab ebx=000014f2 ecx=000003b3 edx=00000630 esi=00000395 edi=000014fc
  99.  eip=000003ff esp=000014ee ebp=00001518 iopl=3 -- vm -- nv up ei pl nz na po nc
  100.  cs=0ab0 ss=10ed ds=10ed es=10ed fs=0000 gs=0000  cr2=01330ffe  cr3=001d2000
  101.  0ab0:000003ff 90             nop
  102.  --p
  103.  eax=000000ab ebx=000014f2 ecx=000003b3 edx=00000630 esi=00000395 edi=000014fc
  104.  eip=00000400 esp=000014ee ebp=00001518 iopl=3 -- vm -- nv up ei pl nz na po nc
  105.  cs=0ab0 ss=10ed ds=10ed es=10ed fs=0000 gs=0000  cr2=01330ffe  cr3=001d2000
  106.  0ab0:00000400 dc4e04         fmul    qword ptr ìbp+04┘ ss:151c=bff0000000000000
  107.  --p
  108.  eax=000000ab ebx=000014f2 ecx=000003b3 edx=00000630 esi=00000395 edi=000014fc
  109.  eip=00000403 esp=000014ee ebp=00001518 iopl=3 -- vm -- nv up ei pl nz na po nc
  110.  cs=0ab0 ss=10ed ds=10ed es=10ed fs=0000 gs=0000  cr2=01330ffe  cr3=001d2000
  111.  0ab0:00000403 90             nop
  112.  --p
  113.  eax=000000ab ebx=000014f2 ecx=000003b3 edx=00000630 esi=00000395 edi=000014fc
  114.  eip=00000404 esp=000014ee ebp=00001518 iopl=3 -- vm -- nv up ei pl nz na po nc
  115.  cs=0ab0 ss=10ed ds=10ed es=10ed fs=0000 gs=0000  cr2=01330ffe  cr3=001d2000
  116.  0ab0:00000404 dc4ee8         fmul    qword ptr ìbp-18┘ ss:1500=80009455373a92f4
  117.  --p
  118.  eax=000000ab ebx=000014f2 ecx=000003b3 edx=00000630 esi=00000395 edi=000014fc
  119.  eip=00000407 esp=000014ee ebp=00001518 iopl=3 -- vm -- nv up ei pl nz na po nc
  120.  cs=0ab0 ss=10ed ds=10ed es=10ed fs=0000 gs=0000  cr2=01330ffe  cr3=001d2000
  121.  0ab0:00000407 90             nop
  122.  --p
  123.  eax=000000ab ebx=000014f2 ecx=000003b3 edx=00000630 esi=00000395 edi=000014fc
  124.  eip=00000408 esp=000014ee ebp=00001518 iopl=3 -- vm -- nv up ei pl nz na po nc
  125.  cs=0ab0 ss=10ed ds=10ed es=10ed fs=0000 gs=0000  cr2=01330ffe  cr3=001d2000
  126.  0ab0:00000408 dd5ee8         fstp    qword ptr ìbp-18┘ ss:1500=80009455373a92f4
  127.  --p
  128.  ***** lets look at term for this machine *******
  129.  --dd bp-18 l2
  130.  10ed:00001500  373a92f4 80009455 *** not is a small negative number *****
  131.  --g
  132.  **** after running througth the loop many times term get to be this*****
  133.  *** and doesn't change or ever become +1 ********
  134.  10ed:00001500  00000000 80000000
  135.  
  136. ========================================================================    
  137.