What is the inclusive range of float and double in Java?

前端 未结 5 554
你的背包
你的背包 2020-11-28 12:22

What is the inclusive range of float and double in Java?

Why are you not recommended to use float or double for anything where precision is critical?

5条回答
  •  -上瘾入骨i
    2020-11-28 13:25

    Of course you can use floats or doubles for "critical" things ... Many applications do nothing but crunch numbers using these datatypes.

    You might have misunderstood some of the various caveats regarding floating-point numbers, such as the recommendation to never compare for exact equality, and so on.

提交回复
热议问题