Why is my number being rounded incorrectly?

后端 未结 5 1076
攒了一身酷
攒了一身酷 2021-01-18 05:00

This feels like the kind of code that only fails in-situ, but I will attempt to adapt it into a code snippet that represents what I\'m seeing.

float f = myFl         


        
5条回答
  •  一向
    一向 (楼主)
    2021-01-18 05:18

    Replace with

    double f = myFloat * myConstInt;
    

    and see if you get the same answer.

提交回复
热议问题