News for hackers. Stuff that matters.
Re:The programming error that cost Mt. Gox 2609 Bitcoins by Nilzor on Monday March 03, 2014 @04:35AM (#7332832)
How can a protocol dealing with currency invented after year 2000 have limits on the number of decimals or its positionn?
Re:The programming error that cost Mt. Gox 2609 Bitcoins by bunderbunder on Monday March 03, 2014 @10:47AM (#7334333)
In a nutshell, because sometimes the point really does not (and should not) float.

The main reason for choosing variable-precision numbers for general-purpose computing is that they have a very wide dynamic range that can adjust automatically, which makes them easier to use in more situations. In financial applications, that advantage doesn't really apply; banks don't often encounter situations where customers are worried about a ten thousandth of a cent, and they never encounter situations where it's suddenly OK to only track a transaction with dollar-level precision.

Meanwhile there are some risks to using arbitrary-precision math too. If BTC used floats, then that might result in it being vulnerable to attacks that are able to take advantage of rounding errors in floating-point math. If BTC used infinite-precision decimals, then that might result in it being vulnerable to attacks that work by creating ridiculously high-precision numbers that implementations have a hard time dealing with.

Re:The programming error that cost Mt. Gox 2609 Bitcoins by bnr on Monday March 03, 2014 @08:45AM (#7333628)
I have 1 bitcoin. I send you 2^-32 btc. How much do I have left?
Re:The programming error that cost Mt. Gox 2609 Bitcoins by nfoz on Monday March 03, 2014 @08:38AM (#7333597)
I'll hazard a guess: the protocol might not want to allow arbitrarily large transaction messages. Could introduce points of failure / DOS'ing.