4 ms·
BTC use fixed-point math with 64-bit unsigned integers. Precision is 8 decimal places. So at least as currently built, I believe 1 Satoshi is the smallest poss
by bunderbunder 13y ago
BTC use fixed-point math with 64-bit unsigned integers. Precision is 8 decimal places. So at least as currently built, I believe 1 Satoshi is the smallest possible unit of Bitcoin.
There's talk about it being possible to move the decimal point with a protocol update, but I'm not sure about how the logistics of that would work, or just how far it's possible to move it.
- Nilzor 13y agoHow can a protocol dealing with currency invented after year 2000 have limits on the number of decimals or its positionn?
- nfoz 13y agoI'll hazard a guess: the protocol might not want to allow arbitrarily large transaction messages. Could introduce points of failure / DOS'ing.
- bnr 13y agoI have 1 bitcoin. I send you 2^-32 btc. How much do I have left?
- bunderbunder 13y agoIn 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.
- wyager 13y agoThe idea would have been to allow BTC software to be written in languages that only have float support (like JS). The Bitcoin code itself actually frequently uses decimal64 as well as uint64_t.