Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The easy way would've been to output a fixed fraction precision rather than a floating point number directly, but that doesn't mean the underlying data or checked algebraic operations are any good.

There are several things that could've prevented this, but apparently they become forgotten every few decades or so. Here's one that could help:

A fixed-point math library using a 64-bit word format like Q1:49:14. That would be a signed, 49-bit whole number with a 14-bit fraction (4 digits for nominal storage / 2 digits for settlement rounded in-place). With a ~$562 trillion limit, it would have an effective range of -562,949,953,421,311.9999 to +562,949,953,421,311.9999. This would work for almost all banking operations but could break down in hyperinflation and the distant future, where reserve and government banking would likely hit "Y2K" issues with it first. Considering 128-bit types exist (although at double the storage cost), it might be worth creating a Q:1:60+:14 format with built-in Hamming code (or similar) ECC for protection beyond that which exists at the hardware level (RAM, possibly CPU caches & IO backplane, probably storage.. but ECC and integrity isn't universal nor always possible).



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: