in reply to perl floating number addition
To calculate dollars "accurately" with 2 decimal places, you need
to calculate right from the beginning in cents as integers!
So just calculate with integers in the desired accuracy and shift the decimal point afterwards²!
And now imagine you're an alien with 3 fingers 4 and you have only computers that calculate in decimal fractions¹... wouldn't this annoy you, too?
Cheers Rolf
Footnotes:
... indeed "Although the 68000 has a 16-bit data bus... internally it can operate on ... 4-bit binary coded decimal (BCD), ..."
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: perl floating number addition
by ig (Vicar) on Jul 18, 2009 at 15:27 UTC | |
Re^2: perl floating number addition
by spx2 (Deacon) on Jul 18, 2009 at 17:42 UTC |