Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Improving double precision stability of vb.net in Windows 98

Status
Not open for further replies.

jamesrhaynes

Programmer
Nov 1, 2003
19
US
Here are discoveries we made relative to the instability of vb.net on windows 98 when using double precision arrays (see thread796-863966).

1) Calculations of the sort:
A(i,j) = B(I,J)*C(j,k) + whatever...
when all are declared as double will not store a double in A(i,j) if the right side calculation is outside the bounds of 'single' precision numbers. In that case, it stores an NaN for the array element A(i,j). This is resolved by taking a two step approach where C is a simple double variable.

C = B(I,J) + whatever...
A(I,j) = C

With the double simple dependent variable it seems to work to double precision but not with a dependent element of a double precision array!

2) Furthermore, the statement ReDim A(M,M) on a double precision array does not necessarily set all elements of the array to a full double precision zero, so an additional improvement is to manually store double precision zeros in the elements of the array.

3) Even with these improvements the calculations themseleves in double precision are still a somewhat inaccurate and unstable. That is, the same calcualtion results in differences each time it is run (even the first run from startup can be different from the next run from startup). The improvements 1 and 2 will get the behavior to manageable proportions (variation within a few percent in our case) but it is not a complete solution and not comparable to the perfect answers and perfect stability on Windows XP and others.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top