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?