3 ms·
And especially the topmost comment by stephencanon (highlights): https://news.ycombinator.com/item?id=16514962 https://news.ycombinator.com/item?id=16514962 "
by acqq 7y ago
And especially the topmost comment by stephencanon (highlights):
https://news.ycombinator.com/item?id=16514962 https://news.ycombinator.com/item?id=16514962
"If you want a default decimal floating-point type, the only defensible choice is the decimal128 type standardized by IEEE 754. It has a fully-defined arithmetic, specified by experts who have spent their careers thinking about the issues involved, and is wide enough to exactly represent the US national debt in every currency used on earth.
There are situations where other decimal floating-point types are appropriate, but if you do not understand the tradeoffs you are making, you should be using decimal128."
and
"I would be remiss not to note that Intel has made available a well-tested complete implementation of IEEE 754 decimal64 and decimal128 under 3-clause BSD: http://www.netlib.org/misc/intel/ http://www.netlib.org/misc/intel/ "
- atemerev 7y agoDec64 is approachable to try to implement it on my own where it is needed the most (Java/JVM). decimal64/128 is most certainly not.
- acqq 7y agoCan’t you link the existing C code by Intel, linked above and BSD licensed? There’s also GPL licensed one by IBM if you prefer that, linked in my other post. No need to use the worse solution, which is dec64, unless you have some very specific goals.