Answer the question
In order to leave comments, you need to log in
Why complains about double > float conversion?
I do not understand where double is taken here?
Answer the question
In order to leave comments, you need to log in
double you have constants in the expression. By default real constants are double. Therefore, all other components of the expression are converted to double, and when assigned, it is necessary to convert again to float with loss of precision, and the compiler informs about this.
To make constants float, you need to use the 'f' suffix: 9.0f. Then the entire expression will be evaluated to float.
appears when multiplying or dividing
to save the result as accurately as possible,
IMHO, you should not bother
I think it will be solved if we replace the type of variables fahr and celsius from float to double.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question