3 ms·
Exactly. I've been preaching for other languages to get that for years. Avoid many of these odd floating point issues, esp when handling money. On top of it, th
by nickpsecurity 11y ago
Exactly. I've been preaching for other languages to get that for years. Avoid many of these odd floating point issues, esp when handling money. On top of it, the POWER processors were wise enough to include a decimal unit to accelerate it.
- Kristine1975 11y agoThe IEEE 754 floating-point standard even includes decimal- instead of binary-based floating-point types, i.e. which can represent e.g. 0.1 accurately: https://en.wikipedia.org/wiki/IEEE_floating_point#Basic_and_interchange_formats https://en.wikipedia.org/wiki/IEEE_floating_point#Basic_and_... I think this is what IBM's POWER CPUs implement. And there's even a proposal to add it to the C++ standard: http://open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3871.html http://open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3871.ht... And the C standard: http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1312.pdf http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1312.pdf
- nickpsecurity 11y agoOh heck I didnt even know that. Yes, the IBM chips implement it on top of FPU with hardware/firmware combo. Googling POWER decimal gave me a PDF with floor plan and all. Their reasoning is that, unlike scientific community, most people use FPU's while thinking in and requiring decimal properties. So why not offer them a decimal unit, eh? Glad it might get into C++ standard.