Is it possible to differentiate between 0 and -0?

前端 未结 7 1433
鱼传尺愫
鱼传尺愫 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:21

    If your machine has distinct representations for -0 and +0, then memcmp will be able to distinguish them.

    If padding bits are present, there might actually be multiple representations for values other than zero as well.

提交回复
热议问题