Improve company productivity with a Business Account.Sign Up

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 331
  • Last Modified:

Math calc VB.NET in XP or WIN98

I am developing a differential element solution in Visual Basic .NET

For this I need to perform matrix calculations for matrixes between 100 and 10000 elements. I defined all variables and arrays as double. Number of double calculations are between 10^5 and 10^10.

All calculations seems to converge correctly when done on a XP-proffesional platform (Pentium 4), where my IDE Visual basic is installed.

After installation on Win98 (Pentium III), the program seems to work fine. However, occasionally the calculations crash due to a NaN error. Notice that exactly the same calculations do not crash at the XP platform.

During the calculations the following functions are used from System.math: Sqrt() and Log().
Further I use a double division of two small doubles, which result should be between 0 and 2.
The former two small doubles are formed by addition of 100 to 10000 double*double calculations.

I tried using different .NET Frameworks, but that did not help.

Please help....
  • 3
  • 3
1 Solution
Éric MoreauSenior .Net ConsultantCommented:
I had some similar problems in VB6 with rounding operations (see ).

I am sure that something changed in XP but I don't what and why.

In my case, I ended up building my own rounding function.
vohaanAuthor Commented:
I do not use any rounding functions, but may be the rouding of the values after the double calculations has some effect. The problem is I only find differences after many double calculations, the first calculations are not notticable different.

Except for different OS I tied also different Processos (P4 and P3) the problem is the same: Win98 gives a wrong result....
Éric MoreauSenior .Net ConsultantCommented:
I didn't want to mean that only the Round function has problems. I meant that something had changed into the Windows Math library.
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

vohaanAuthor Commented:
It could be possible. Do you know of how to correct it?

I know that VB.NET uses the .NET Framework to implement some math functions. But simple multiplication of doubles is that part of VB.NET source or distributed with .NET Framework? Or are there any other files for this?

Are double calculations not transferred to the processor and evaluated in 'hardware' ? Maybe Win98 interpretes the results coming back form the processor differently ?

Éric MoreauSenior .Net ConsultantCommented:
>>It could be possible. Do you know of how to correct it?

No that's why I created my own rounding function.
vohaanAuthor Commented:
I found out that sometimes the calculations are going correct at WIN98 and sometimes they are going false. Nothing changes only the same calulation again and again.

Is this kind of instability known for Win98?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now