In C++,the type of floating-point literals is double
by default;
auto dval = 3.14; // dval is a double
So,in the statement float fval = 3.14
, 3.14 -> float
means double -> float
?
Another similar question:
float fval = ival + 3.14;
what type conversion is happening here