Is there a negative zero?

后端 未结 2 677
醉梦人生
醉梦人生 2021-01-14 18:28

I\'m coding a simple calculator just to get started with iPhone dev. The thing is I have a (-) button thats supposed to negate whatever is put to the screen

2条回答
  •  迷失自我
    2021-01-14 18:56

    There's no such thing as negative zero.

    For a binary integer, setting the sign bit to 1 and all other bits to zero, you get the smallest negative value for that integer size. (Assuming signed numbers.)

提交回复
热议问题