C programming: Does float always auto-convert to double when multiplying mixed data types?

后端 未结 5 2323
感动是毒
感动是毒 2021-02-20 14:17

In Steven Prata\'s book \"C Primer Plus\", there\'s a section on Type Conversions, wherein \"The basic rules are\" section has stated in rule 1:

Under K&R C,         


        
5条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-20 15:01

    Yes you can rely on C to promote floats to doubles when evaluated.

    708 Otherwise, if the corresponding real type of either operand is double, the other operand is converted, without change of type domain, to a type whose corresponding real type is double. 
    

    I'm using the documentation found here.

    Sorry, I cited the wrong thing earlier

提交回复
热议问题