Exception to Number Format Exception with “D” and “F”?

后端 未结 3 1817
不知归路
不知归路 2021-01-17 12:42

I have run into a very strange problem in my code. I have a simple temperature converter where the user enters the temperature in Celsius and, after pressing \"Convert\", th

3条回答
  •  离开以前
    2021-01-17 13:15

    some languages allow you to put letters after number literals to signify what type it is.

    if you simply wrote 12.3, it might not know whether it is a float or a double(or it'd have to infer or cast it).

    Your number parser must be picking up on these letters.

    • 12.3d is 12.3 as a double
    • 12.3f is 12.3 as a float

提交回复
热议问题