S
Sanjeev Azad
I'm porting my application from VC++ 6.0 to VS .Net
and experiencing a difference in the double precisions.
I have the following code in my application
double val = 16e-6;
When I debug it, the debugger shows the value of val as
"1.599999999999999e-5", not "1.6000000000000e-5",
which is what the debugger shows in VC++6.0.
I understand that "1.599999999999999e-5" is the value that
actually gets stored in the memory for this double. However,
it seems that the value "1.599999999999999e-5" when used in arithmatic
operations fianlly gives a result which is different form what I get in
VC++6.0
I am unable to understand the reasoning behind the difference in the
results
in the two compilers.
I am looking for a way to ensure that math operations over numbers in .NET
output
gives same values as in VC++6.0. Are there any settings that need to be done
to achieve
this?
Thanks,
Sanjeev
and experiencing a difference in the double precisions.
I have the following code in my application
double val = 16e-6;
When I debug it, the debugger shows the value of val as
"1.599999999999999e-5", not "1.6000000000000e-5",
which is what the debugger shows in VC++6.0.
I understand that "1.599999999999999e-5" is the value that
actually gets stored in the memory for this double. However,
it seems that the value "1.599999999999999e-5" when used in arithmatic
operations fianlly gives a result which is different form what I get in
VC++6.0
I am unable to understand the reasoning behind the difference in the
results
in the two compilers.
I am looking for a way to ensure that math operations over numbers in .NET
output
gives same values as in VC++6.0. Are there any settings that need to be done
to achieve
this?
Thanks,
Sanjeev