Is it possible to differentiate between 0 and -0?

前端 未结 7 1637
鱼传尺愫
鱼传尺愫 2021-01-31 07:11

I know that the integer values 0 and -0 are essentially the same. But, I am wondering if it is possible to differentiate between them.

For exam

7条回答
  •  情书的邮戳
    2021-01-31 07:16

    For an int (in the almost-universal "2's complement" representation) the representations of 0 and -0 are the same. (They can be different for other number representations, eg. IEEE 754 floating point.)

提交回复
热议问题