1
I want to do program that doing some calculations with bitcoin values.
I know bitcoin have 8 digits after decimal point (please correct me).
If I store the value as double I worry that I might lose precision when I do the calculations.
Shall I use int64_t instead? It generally can store 18 digit number, so if I multiply by 100,000,000, I will be able to work in satoshi units and never lose precision.
After that I will need to divide by 100,000,000 so I can print it.
And what about gcc quadruple precision?
Or shall I use GNU MP library instead?
2You can use the same type of bitcoin-core for store the value of the satoshi, so int64_t. The number is always int, I think you can use the long type because also the bitcoin core RPC framework response use the conversion in Bitcoin and the wrapper libraries used the long type – vincenzopalazzo – 2019-08-09T09:17:21.373