Entering negative numbers in Calc?

Discussion in 'OS X Yosemite (10.10)' started by Mork, Jan 9, 2015.

  1. Mork macrumors 6502

    Joined:
    Jan 9, 2009
    #1
    In programmer mode, I want to be able to enter, say, -94 (ASCII value, in this case), and see the resultant binary string.

    Yet, in the Mac calculator, in programmer mode in Yosemite, I don't see a "+/-" type button or a way to enter negative numbers.

    I had to resort to doing a manual 2's compliment... :(

    I must be missing something.

    Thanks in advance.

    - m
     
  2. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #2
    As far back as I can remember, the buttons are "2's" for 2's-complement and "1's" for 1's-complement. 2's-complement of 94 would give the result you want.

    I don't have Yosemite at hand, so if don't see one of these buttons, post a screenshot of the Programmer calculator.

    Or use the expression 0 - 94 = (i.e. subtract 94 from 0). The resulting unsigned number in Calculator's display will be a big number starting with the digits 184...
     
  3. Mork thread starter macrumors 6502

    Joined:
    Jan 9, 2009
    #3
    Thanks Chown. :)

    Great info.

    The 2's compliment does indeed work as I found out later after posting. I was trying to understand an ASCII->Hex conversion code in some Java code and wanted to do the conversion manually so I was sure I understood what was happening.

    Thanks very much for your excellent reply.

    - m
     

Share This Page