News for hackers. Stuff that matters.
Re:0.30000000000000004 by lsaferite on Friday November 13, 2015 @04:44PM (#10562595)
Do they do USD interest calculations in something smaller than 1/10000 (decimill I think)?

The issue with BCD would be data store support and CPU support right? Do CPUs support doing math directly with BCD values and does your DB support doing math directly with BCD values?

In any case, using floating point for any currency calculations is a huge no-no, even though a lot of things do it anyway.

I work with Magento daily and all their currency math uses PHP floats and the rounding errors drive me bonkers.

Re:0.30000000000000004 by mehrdada on Friday November 13, 2015 @11:58PM (#10564530)
> Do CPUs support doing math directly with BCD values

Perhaps surprisingly to some, x86 has instructions for BCD manipulation at the CPU level. Legacy.

Re:0.30000000000000004 by jerven on Saturday November 14, 2015 @04:06PM (#10567257)
In IBM POWER 6 this returned as an optimisation in hardware.

https://books.google.ch/books?id=SPXHAgAAQBAJ&pg=PA44&lpg=PA...