It is not about printing. It is about storing the value.
int x = 1234;
double y = 0.3456;
double z = x + y;
Currently z contains 1234.35. I want z to contain 1234.3456
What can be done to achieve this?
It is not about printing. It is about storing the value.
int x = 1234;
double y = 0.3456;
double z = x + y;
Currently z contains 1234.35. I want z to contain 1234.3456
What can be done to achieve this?
It does contain 1234.3456. Check for yourself:
#include <cstdio>
int main()
{
int x = 1234;
double y = 0.3456;
double z = x + y;
printf("%.8f\n", z);
}
1234.34560000
The double accuracy contains a bit less than 16 decimal digits. The printed value of z is less precise than the stored one. If you want more than 16 digits, you should consider specific libraries like mpfr