how to restrict float number to 1 digit after decimal point

后端 未结 0 829
故里飘歌
故里飘歌 2021-01-19 21:21

I have a float number 242.1356783 and -87.10234512, I need to restrict it it to 242.1 I tried below on cortex m4 microcontroller

1.data[i] = (int)(data[i] *10);

相关标签:
回答
  • 消灭零回复
提交回复
热议问题