Re: sorry .09 instead of .08



zero wrote:

BigDecimal has its own problems, beside the speed. If you initialize a BigDecimal with a double constant, you're in the same boat as using a normal double when it comes to rounding errors.

If you initialise an int or long with a double you'll get the same rounding errors (plus overflow errors for added fun). So, don't use doubles for financial calculations.


Tom Hawtin
--
Unemployed English Java programmer
http://jroller.com/page/tackline/
.



Relevant Pages

  • Re: Value close to zero.
    ... floating point value is zero may become a problem. ... Just comparing some quantity x with matlab's 'eps' is not an adequate test ... are likely to differ from zero only because of rounding errors, ...
    (comp.soft-sys.matlab)
  • Re: Weirdness: (-0.666667 + 0.333333)
    ... > becuase of rounding errors. ... > I'm writing a program that draws graphs on a cartesian plane, ... The only thing you can do is to compare your value of x to zero ...
    (comp.lang.cpp)
  • Re: Weirdness: (-0.666667 + 0.333333)
    ... x - epsilon() < 0 ... >>becuase of rounding errors. ... The only thing you can do is to compare your value of x to zero ...
    (comp.lang.cpp)
  • Re: Round off error
    ... For me, I get zero in the third step, not a very small number. ... Public Sub Test2 ... Dim di as Double ... Ultimately, though, the only way to prevent all rounding errors is to ...
    (microsoft.public.excel.programming)