This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28027: 不同类型的数据转换的问题

Part Number: TMS320F28027


三个变量分别定义如下:uint16_t a ,uint16_t b,float c

问题如下:

1.当一个整型与浮点数相加结果是浮点数还是整型?相加的时候是否要把整数b先强制转换为浮点数?乘法运算后因为要赋值给整型变量a,那么此时是否需要强制把乘积转换为整型数?

 a=b+c;

因为c是浮点数,那么这时候是否需要把变量b先转换为float再与变量c相加?

2.当一个整型与浮点数相乘结果是浮点数还是整型?相乘的时候是否要把整数b先强制转换为浮点数?

 a=b*c;

谢谢!