Q:

Define a sign of Int when it's zero and negative-zero

I have a value of Int type. I need to define a sign of this value. And I don't know how to handle edge-case with -0.

signum - returns -1 if this value is negative and 1 if it’s positive;
  otherwise, 0

0.signum()  // 0
-0.signum() // 0

I tried to convert it to Double, but also it didn't help.
Double(-0).floatingPointClass == .negativeZero // false

And to String
String(-0) // "0"

Is there any solution for this problem ? Or 0 and -0 of Int type is the same values ?

A:

This can't be done.  0 and -0 do not have separate representations as an Int.  Integers in Swift (as in other programming languages) use 2's complement representation.  To negate a number, you invert all of the bits and add 1.  Starting with the Int 0, all bits are 0.  Inverting all of the bits results in all 1's, and then adding 1 causes it to go back to all 0's as the carry bit rolls off the top.  So 0 and -0 have the exact same representation.

