Search code examples
type-conversiondoubleprecisionlong-integer

Converting a double to a long, then back to double?


Does Converting a double to a long, then back to double, guarantees keeping the exact value to the left of the decimal point?

EDIT: Working with C++: Conversion is as follows:

double d_var = func();
long l_var = (long)d_var;
d_var = (double)l_var;

Solution

  • For every programming language I have worked with it will keep the value to the left of the decimal point.