Bitcoin value as int64_t or as double 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?
I want to do program that doing some calculations with bitcoin values.
I know bitcoin have 8 digits after decimal point (please correct me).

There is no decimal in bitcoin at code level. There is no &quot;bitcoin&quot; unit either. There is only satoshi. And it is best to always stick to integer types instead of floating point types for 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.

The number of digits doesn't matter, the size of the number in binary matters.
Since the maximum value you can have as &quot;amount&quot; for bitcoin is 2100000000000000 (21 million bitcoin or 21 million * 10^8 satoshi) and this value is 7 bytes (0x0775f05a074000), you need an 8 byte (64 bit) integer. So your options are a signed or unsigned 64-bit integer value type. The sign doesn't matter because the most significant bit is never set due to the size of the max value.
By the way a 64-bit signed integer has a max value of 9,223,372,036,854,775,807 which is 19 digits.