Ah HAH! As I suspected.
Dave, you are right that '1.0' is a double. However, I still believe that two floats used in a calculation result in a double, in the same way that two chars used in a calculation result in an int. In any case, the compiler can deal with that and generally puts out a warning, not an error.
Actually, two chars used in a calculation result in a char, but there may be overflow. Calculations stay withing their type. But, yes. The reason for the 'double' part of the diagnostic was with this.
const double ovrh = 2.27;
Multiplying two floats results in a float; but adding that result to a double promotes the float result to a double. And yes, attempting to then assign this double result to a float should generate a warning.
Reputation Points: 2780
Solved Threads: 312
long time no c
Offline 4,790 posts
since Apr 2004