On Sat, 30 Oct 2004 14:23:01 +0100, Graham gt@pobox.com wrote:
Neither float nor double can truly represent some numbers. Just as 1/3 or 1/7 cannot be expressed exactly in decimal, some numbers - e.g. 0.1 - do not have an exact binary representation. Hence the tendency for the result to come back as a recurring decimal.
I didn't want to disallution him so soon.
Actually it's quite a minefield. BigDecimal has seven different rounding options, which is perhaps why my BT bill often computes the VAT to be a penny less than that given by my accounts program.
BT seem to calculate to 1/10 of a penny, then always round down to the whole penny for the final figure. Can you image the complaints if BT rounded up? (Extra £10,000 revenue per million customers)