Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Mork

macrumors 6502a
Original poster
Jan 9, 2009
539
34
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
 

chown33

Moderator
Staff member
Aug 9, 2009
10,998
8,887
A sea of green
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...
 

Mork

macrumors 6502a
Original poster
Jan 9, 2009
539
34
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
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.