News for hackers. Stuff that matters.
Re:The Fundamental Axiom of Floating Point Arithmetic by dvt on Wednesday August 05, 2020 @02:01AM (#24057700)
Great article, and a wonderful explanation as to why one should avoid (at all costs) doing financial calculations using IEEE-754 floating point math.

> ... where each \epsilon is very small, on the other of \epsilon_machine.

Not sure if author is reading replies here, but I think "other" should be "order."

Re:The Fundamental Axiom of Floating Point Arithmetic by KMag on Wednesday August 05, 2020 @03:21AM (#24058117)
That depends on the type of the financial calculations you're doing. Certainly accounting and billing shouldn't be done in binary floating point formats. Financial modelling and forecasting calculations aren't exact calculations, and the intermediate library functions for binary floating point may suffer less rounding error than practical alternatives. Also, computational efficiency comes into play once you're at the scale of spending millions of dollars per year on hardware and electricity for financial modelling.

Also, since IEEE-754-2008, there are decimal IEEE-754 floating point numbers, which are useful for some types of financial calculations.

Re:The Fundamental Axiom of Floating Point Arithmetic by cesaref on Wednesday August 05, 2020 @03:19AM (#24058105)
... except that every financial trading system i've ever seen is full of floats (and i've seen a lot).
Re:The Fundamental Axiom of Floating Point Arithmetic by bigiain on Wednesday August 05, 2020 @04:05AM (#24058349)
Many years back I worked on a project involved in heavily government regulated gambling (horse race betting). The rules were every calculation including all intermediate steps had to be done to at least 1/10,000th of a cent precision, and rounding was only allowed once at the very final step.

(Which, since my part of that project was a Javascript/jQueryMobile mobile webapp, I managed to push all that to the backend team saying "I'm doing calculations using Javascript, I don't even have proper integers to work with here - you'll need to send me all financial figures as strings, and do all the calculations at your end according to the rules. I can accurately display strings, I will not look a judge in the eye and try to claim I can accurately calculate _anything_ monetary in Javascript.")

Re:The Fundamental Axiom of Floating Point Arithmetic by jhj on Wednesday August 05, 2020 @03:03AM (#24058034)
IEEE 754 also provides for decimal radix floating point, just that there is no real hardware support for it beyond some IBM and Fujitsu chips, and what you can put together on FPGAs.