Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / February 2005

Tip: Looking for answers? Try searching our database.

Difference in double precision...

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sanjeev Azad - 10 Feb 2005 06:47 GMT
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
Sebastian Dau - 10 Feb 2005 09:02 GMT
> I'm porting my application from VC++ 6.0 to VS .Net
> and experiencing a difference in the double precisions.
[quoted text clipped - 24 lines]
> Thanks,
> Sanjeev

Hey Sanjeev,

I think this might be possible because MS uses a slightly different
standard for double precision number representation from VC6 ("MS double")
to C++.NET (Double complies with the IEC 60559:1989 (IEEE 754) standard for
binary floating-point arithmetic.)

If you figure out more detailed stuff, please let me know.

Sebastian Dau
David Lowndes - 10 Feb 2005 15:13 GMT
>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?

Try setting the /Op (Improve Float Consistency) setting.

Dave

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.