V
van6
code frag:
int main()
{
float fval1 = 1.0f;
float fval2 = 2.0f;
double dsum =0.0;
// here is the point ;
// Are fval1 and fval2 both promoted to type of double prior to adding
or perform the adding
// operation directly (the result of adding is still of type float ? )
dsum = fval1 + fval2;
}
This question may a little stupid . But different books give different
answers.
int main()
{
float fval1 = 1.0f;
float fval2 = 2.0f;
double dsum =0.0;
// here is the point ;
// Are fval1 and fval2 both promoted to type of double prior to adding
or perform the adding
// operation directly (the result of adding is still of type float ? )
dsum = fval1 + fval2;
}
This question may a little stupid . But different books give different
answers.