My code:
// Convert SATOSHIS to BITCOIN
static double SATOSHI2BTC(const uint64_t& value)
{
return static_cast<double>(static_cast<double>(value)/static_cast<double>(100000000));
}
double dVal = CQuantUtils::SATOSHI2BTC(1033468);
printf("%f\n", dVal);
printf("%s\n", std::to_string(dVal).data());
Google output: 0.01033468
Program output: 0.010335 both for printf
and std::to_string
Debugger output: 0.01033468
Do printf
and std::to_string
round the number?
How do I get a string with the proper value?