Re: sorry .09 instead of .08



zero wrote:

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.

They are slower. However, is it going to make your program noticeably slower. Almost certainly not. Better to keep it safe than prematurely optimise.


Using ints is full of traps. No good for a billionaire companies, although longs should do for storage. Operations such as multiplication become tricky. Without treating it as a type in its own right, you can easily get into trouble.

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



Relevant Pages

  • Re: sorry .09 instead of .08
    ... > zero wrote: ... >> BigDecimal will be slower though. ... If the values are all currency ... > Using ints is full of traps. ...
    (comp.lang.java.help)
  • Re: sorry .09 instead of .08
    ... >> BigDecimal will be slower though. ... If the values are all currency ... >> values, with only 2 numbers after the decimal point, ints are a good ... too lazy and wanted to keep the message short ...
    (comp.lang.java.help)