On 07.04.2022 20:55, David Mertz, Ph.D. wrote:
On Thu, Apr 7, 2022 at 2:47 PM Marc-Andre Lemburg <mal@egenix.com <mailto:mal@egenix.com>> wrote:
In high finance, I've never seen decimals being used, only floats. Excel is omnipresent, sets the standards and uses IEEE 754 floats as well (plus some black magic which sometimes helps, but often makes things worse):
In forex, instantaneous exchange rates are defined as a specific number of decimal digits in a currencyA/currencyB exchange rate (on a particular market).
This is about US$6.6 trillion/day governed by these rules... FAR more than the combined size of ALL securities markets.
It was something like 2007 when the NYSE moved from prices in 1/32 penny to a fixed-length decimal representation.
... and then you end up with problems such as these: https://www.wsj.com/articles/berkshire-hathaways-stock-price-is-too-much-for... (a good problem to have, BTW) Seriously, the actual trades will still use fixed numbers in many cases (after all, each trade is a legal contract), but everything else leading up to the trades tends to use floats: models and other decision making tools, pricing, risk calculation, hedging, etc. etc. But that's just one application space. There are plenty others where decimal are used. Still, to get back to the original topic, in most cases, a fixed high enough precision is usually enough to keep applications, users, authorities and regulators happy, so the concept of a global default works well. You can easily round decimals of this higher precision to whatever precision you need for a particular purpose or I/O, without changing the context precision. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Experts (#1, Apr 07 2022)
Python Projects, Coaching and Support ... https://www.egenix.com/ Python Product Development ... https://consulting.egenix.com/
::: We implement business ideas - efficiently in both time and costs ::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 https://www.egenix.com/company/contact/ https://www.malemburg.com/