Changing the floating point arithmetic model in asp.net -- pleasehelp

A

almurph

Folks,


I'm writing C# in Visual Studio v9.0.2 using the ASP.NET framework
v3.5 and am trying to manipulate the floating point arithmetic model
that the ASP.NET framework uses.

I would appreciate any user comments/experiences that you may want to
share.

I ask as I am trying to emulate the C compiler behaviour for some
code have I have converted. I tried using the System.Single type and
noticed some minor improvements. I then wrote a method in C++ and
imported this as as a DLL. Once again I noticed an improvement (by the
word improvment what I mean is that the calculation is closer to the C
equivalent).

However the small differences tend to build up and go pair-shaped
after a few loops.

So, I would appreciate any user comments/experiences that you may
want to share.

Cheers,
Al.
 
P

Pavel Minaev

That said, the short answer is: if it's important to you for the results  
to be _identical_ no matter which implementation of floating point code  
you use, then you've either got a problem with your problem description or  
your choice of implementation (i.e. using floating point).

Floating point simply isn't suitable for bit-precise results.  Rounding 
error accumulates, and is dependent on the inputs.  If floating point  
calculations are suitable, there's no use in expecting exact results,  
because that's simply impossible.

I would disagree. Floating point is quite suitable for _bit_-precise
results - so long as your inputs are bit-for-bit the same, and the
rules are well-defined (e.g. IEEE floating-point representation and
operations), the result should be bit-for-bit the same, too.

Of course, I doubt that the original poster actually needs that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top