Working with floating point values



I'm working on a project that uses floating-point values (doubles), and I'm
being driven crazy by something pretty basic. I understand that it's in the
nature of floating-point calculations to produce values like
0.10000000000000003, when what I really want is 0.1. But is there any way to
eliminate that digit at the end? I've tried rounding, but that simply moves
the digit to the least significant position, such as 0.1000003.

Failing that, can anyone recommend any good online articles for dealing with
floating-point issues, beyond using Epsilon for zero comparisons? Thanks in
advance.

David Veeneman
Foresight Systems


.



Relevant Pages

  • Re: Leading zero for printing real numbers
    ... FORTRAN's output of values in floating-point form started with a decimal point, ... and was also not standard floating-point notation. ... one digit before the decimal point. ... were rectified in the design of PL/I, in which the leading zero before the point ...
    (comp.lang.fortran)
  • Re: Working with floating point values
    ... David Veeneman wrote: ... > I'm being driven crazy by something pretty basic. ... > in the nature of floating-point calculations to produce values like ... > moves the digit to the least significant position, ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: Working with floating point values
    ... "David Veeneman" wrote: ... > I'm working on a project that uses floating-point values, ... > being driven crazy by something pretty basic. ... > the digit to the least significant position, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Working with floating point values
    ... David Veeneman wrote: ... > I'm working on a project that uses floating-point values, ... > the digit to the least significant position, ... > Failing that, can anyone recommend any good online articles for dealing with ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: Working with floating point values
    ... Rounding won't help because the some floating point numbers simply can't be ... you can test conditionals by seeing if a ... > I'm working on a project that uses floating-point values, ... > the digit to the least significant position, ...
    (microsoft.public.dotnet.languages.csharp)

Loading