Solved

Math calc VB.NET in XP or WIN98

Posted on 2004-03-23
6
311 Views
Last Modified: 2012-08-14
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....
0
Comment
Question by:vohaan
  • 3
  • 3
6 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 10663597
I had some similar problems in VB6 with rounding operations (see http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20311047.html ).

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.
0
 

Author Comment

by:vohaan
ID: 10667055
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....
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 10667073
I didn't want to mean that only the Round function has problems. I meant that something had changed into the Windows Math library.
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

Author Comment

by:vohaan
ID: 10667138
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 ?

0
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 250 total points
ID: 10667154
>>It could be possible. Do you know of how to correct it?

No that's why I created my own rounding function.
0
 

Author Comment

by:vohaan
ID: 10688373
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?
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question