Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

number systems/signing

Name: Anonymous 2011-11-22 4:14

Hi /prog/

How does one represent negative numbers in hex/octal, e.g -15. Would the hex value be F1 or -0F? In the example i've been given it says -15 is F1, but I dont see how the sign is represented, shouldn't F1 be +241?

Name: Anonymous 2011-11-22 4:28

sign my anus

Name: Anonymous 2011-11-22 4:37

ok, but my spunk is indelible fyi.

Name: Anonymous 2011-11-22 5:24

That's implementation-dependent.

Name: Anonymous 2011-11-22 7:16

Learn to 2's complement. Then how to translate bits to octal or hexadecimal.

Name: Anonymous 2011-11-22 8:58

>>4
Fuck off, pedantic piece of shit.

>>5
This.

Name: Anonymous 2011-11-22 9:48

>>6
>>4-san isn't being pedantic, cockpouch. Two's-complement representation of negative numbers depends at the very least on how wide your shit is.
The only real answer, given what >>1-kun has bothered to tell us, is -F.

Name: OP 2011-11-22 13:11

>>4
Ok I grasp 2's complement, and going from binary to dec and then to hex is fairly easy, but going from binary to hex is confusing me because of the signing. I take it that like binary there's no way to tell if a hex/oct value is signed or not just by inference?

>>7
I spoke with my tutor about it today, and he confirmed that the correct answer was indeed F1. To expand on my question a bit further (no pun intended), I'm trying to convert a signed decimal in the range -128 to +127 to hex/octal without converting to bin first. Later I also have to go from signed bin to signed dec/hex/oct, which is where the '-' sign would have been handy because i was just doing 'if dec value < 0 then ("-".concat(octal value))'. But i take it the correct way is 'if dec value < 0 then (0-(0.5*range))+octal value'?

I think part my confusion stems from the poor wording of the exercise: the previous part asked for unsigned dec to hex in range 0-127, when i noticed that the same formula also worked for negative values i started to trip out about adding the '-' sign.

Name: Anonymous 2011-11-22 13:21

>>6
No, you fuck off you mental midget. We have a few production level servers here at work that use 1's complement. Now shut up and go scrub another toilet.

Name: Anonymous 2011-11-22 13:22

>>9
go fuck a goat, then finish scrubbing your mental midget

Name: kodak_gallery_programmer !!+smk517PP2af+Xn 2011-11-22 13:25

>>10
I'm not the one making the uneducated comments. Now go run along you hourly worker you. BTW, I'm still not granting your stupid ass the first technical interview.

Name: Anonymous 2011-11-22 15:20

>>9
No, you fuck off you mental toilet. We have a few production level servers here at work that use sign-magnitude. Now up shut and go scrub another midget.

Name: Anonymous 2011-11-22 15:30

Why wouldn't computers just use a negative sign? LOL people overthink everything!

Name: Anonymous 2011-11-22 15:33

>>11
kill yourself already you cock sucking faggot

Name: Anonymous 2011-11-23 0:02

>>11
FUCK YOU JEW

Name: Anonymous 2011-11-23 0:04

>>14

no don't say that.

Name: Anonymous 2011-11-23 7:50

Check my doubles

Name: !!M8okqD4wRfs+xmp 2012-01-10 20:16


Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List