What do these three special floating-point values mean: positive infinity, negative infinity, NaN?

后端 未结 6 597
无人及你
无人及你 2020-12-31 12:22

How can we use them in our codes, and what will cause NaN(not a number)?

6条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-31 12:32

    You can use them as any other number:

    e.g:

    float min = Float.NEGATIVE_INFINITY;
    float max = Float.POSITIVE_INFINITY;
    float nan = Float.NaN;
    

提交回复
热议问题