×

SparkFun Electronics will be closed in observance of memorial day on Monday, May 29th. We will resume normal business hours on Tuesday, May 30th. Any orders placed after 2pm Mountain Time on Friday, May 26th will process and ship out on Tuesday, May 30th.

Member #548552

Member Since: April 24, 2014

Country: United States

  • The negative numbers are probably in a format called Two’s complement, which is a convention for storing negative numbers as binary. In two’s complement, if the most significant bit is set, the number is negative. To get the magnitude of the negative number, you invert it and add one. e.g.:

    if(value & 0x8000) {
        negative = true;
        value = (~value) + 1;
    }
    

No public wish lists :(