Comparing IEEE floats and doubles for equality

前端 未结 15 2354
南方客
南方客 2020-11-30 06:00

What is the best method for comparing IEEE floats and doubles for equality? I have heard of several methods, but I wanted to see what the community thought.

15条回答
  •  无人及你
    2020-11-30 07:04

    Oh dear lord please don't interpret the float bits as ints unless you're running on a P6 or earlier.

提交回复
热议问题