3 ms·
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
by lsaferite 11y ago
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.
- mehrdada 11y ago> Do CPUs support doing math directly with BCD values Perhaps surprisingly to some, x86 has instructions for BCD manipulation at the CPU level. Legacy.
- jerven 11y agoIn IBM POWER 6 this returned as an optimisation in hardware. https://books.google.ch/books?id=SPXHAgAAQBAJ&pg=PA44&lpg=PA44&dq=power7+binary+coded+decimal&source=bl&ots=6VseaHUdfE&sig=Dcs127eSide4fpqgIeX19U1UNOg&hl=en&sa=X&ved=0CB0Q6AEwAGoVChMIk7TYwOiQyQIVRfsOCh3AHwxw#v=onepage&q=power7%20binary%20coded%20decimal&f=false https://books.google.ch/books?id=SPXHAgAAQBAJ&pg=PA44&lpg=PA...