Re: sorry .09 instead of .08



Thomas Hawtin <usenet@xxxxxxxxxxxxxxxxx> wrote in
news:43dd47b0$0$1488$ed2619ec@xxxxxxxxxxxxxxxxxxxxxxxxxx:

> James Westby wrote:
>>
>> The problem is that you can't use floating point arithmetic (doubles)
>> to do precise arithmetic. If possible then you should try using fixed
>> point arithmetic. e.g.
>
> It's probably better to use BigDecimal in most situations.
>
> Tom Hawtin

BigDecimal will be slower though. If the values are all currency values,
with only 2 numbers after the decimal point, ints are a good choice.
.



Relevant Pages

  • Re: sorry .09 instead of .08
    ... >> James Westby wrote: ... >>> The problem is that you can't use floating point arithmetic (doubles) ...
    (comp.lang.java.help)
  • Re: int64 or double
    ... To address the question of why one would use a Floating Point value... ... Doubles make sense. ... -4.94E-3 equates to -0.00494 ... you can see that we have ranges of: ...
    (microsoft.public.dotnet.languages.vb)
  • Re: C sucks at math? (help)
    ... I said I wouldn't try doubles in the real project, ... do similar calculations in a much bigger project and the problem I'm ... the floating point hardware or emulation does. ...
    (comp.lang.c)
  • Re: Floating point issue in sbcl 1.0.10?
    ... If you ensure that your floating point numbers are ... doubles, either by explicitly writing them that way, or by altering ... CL-USER> ... question leads off to all kinds of tangents. ...
    (comp.lang.lisp)
  • Re: C sucks at math? (help)
    ... I had just figured out that the emulation/casting was where it went ... It seems that doubles work for the toy-program, ... the floating point hardware or emulation does. ...
    (comp.lang.c)