#include <stdio.h> #include <stdint.h> int main() { printf("Operations with comas \n"); uint16_t a = (uint16_t)((24.2 - 0)/0.1); /* 241 Incorrect*/ uint16_t b = (uint16_t)((24.2 - 0.0)/0.1); /* 241 Incorrect */ uint16_t c = (uint16_t)((float)(24.2 - 0)...
所以除以0.1得到大约241.99999999999716,将此值转换为整数类型会截断为241。