3 ms·
> After all, if the trade is internal on MtGox, it's just a double in a database. Dude, don't use double to represent money.
by haakon 15y ago
> After all, if the trade is internal on MtGox, it's just a double in a database.
Dude, don't use double to represent money.
- batterseapower 15y agoThere are 21 million bitcoins and they divide down to 8dp, so you need 16 decimal digits to represent them exactly. Coincidentally (?) double precision floating point is capable of precisely representing exactly 16 decimal digits. http://en.wikipedia.org/wiki/Double_precision http://en.wikipedia.org/wiki/Double_precision So using double is in fact perfectly OK in this case.
- TylerE 15y ago16 digits of precision != 16 digits of accuracy.
- tedunangst 15y agoDoubles are capable of accurately and precisely representing 16 digit decimal numbers.
- JeffL 15y agoNot 10^100 + 0.0000000000000001
- tedunangst 15y agoA 116 digit number is not a 16 digit number.
- wladimir 15y ago+1 -- I keep warning people about this, but them don't seem to get it through their thick skull :) The bitcoin client and protocol itself doesn't use doubles internally, but fixed-point numbers. I don't know about MTGox, though.