What are the INFINITY constants in Java, really?

前端 未结 3 1353
萌比男神i
萌比男神i 2020-12-25 12:22

I just recently ran across the constants in the primitive type wrapper classes like Double.POSITIVE_INFINITY and Double.NEGATIVE_INFINITY. In the

3条回答
  •  隐瞒了意图╮
    2020-12-25 12:46

    They do indeed represent positive and negative infinity, which are clearly defined concepts in the IEEE floating point standard. For example, dividing a positive floating point number by zero yields positive infinity. As for the bit pattern itself, it is just a pattern that has been chosen to represent infinity.

提交回复
热议问题