Problems with floating point numbers

From: Bruno Christensen (bc_at_neplan.ch)
Date: 06/30/04


Date: 30 Jun 2004 02:18:13 -0700

Hi

I have problems with floating point numbers. After the following
statement

double x = 0.75 * 0.1;
double z = 7.5 * 0.01;

x and z have the following values:

0.075000000000000011
0.074999999999999997

My compiler: Microsoft Visual C++ .Net. If I use the old Visual Studio
6.0 everything is ok and x and z have correct values:

0.075000000000000
0.075000000000000

Can anybody help?

Regards
Bruno



Relevant Pages

  • Floating Point Problems
    ... I have problems with floating point numbers. ... My compiler: Microsoft Visual C++ .Net. ... If I use the old Visual Studio ... Regards ...
    (comp.programming)
  • Re: Break on first build error?
    ... AFAIK, no. ... compiler shows the errors in the list before you actually build. ... Best regards, ... Productivity add-ins for Visual Studio ...
    (microsoft.public.vsnet.general)
  • Re: Intersections of two lines - limited precision problem
    ... depending on the compiler settings (I was shocked to find that compiling the ... release version of C++ project in MS Visual Studio by default causes it to ... handle floating point numbers less precisely, ...
    (comp.graphics.algorithms)
  • Re: Visual Studio 6 or .NET for C++?
    ... "Paul Schauble" wrote in message ... > I have a choice of Visual Studio 6 ... it has the best compiler to come out of MS in a while. ... Regards, ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Visual Studio 6 or .NET for C++?
    ... "Paul Schauble" wrote in message ... > I have a choice of Visual Studio 6 ... it has the best compiler to come out of MS in a while. ... Regards, ...
    (microsoft.public.vc.language)