I have a homework assignment dealing with binary numbers and integer representation:

one of the questions is that I have to represent 127 and -81 in signed magnitude.

any help on understanding the process of this would be helpful thanks.

Member Avatar for Siersan

Sign-magnitude is probably the simplest of the binary representations. To get the negative binary representation of a negative number, just take the positive number and set the sign bit.

81 is 01010001, so -81 is 11010001. 127 is the largest possible value in a signed 8-bit type, so try the first seven bits 1 and the last bit (the sign bit) 0: 01111111. -127 would simply be the same thing with the sign bit set: 11111111.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.