programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
• Campbell Ritchie
• Jeanne Boyarsky
• Ron McLeod
• Paul Clapham
• Liutauras Vilda
Sheriffs:
• paul wheaton
• Rob Spoor
• Devaka Cooray
Saloon Keepers:
• Stephan van Hulst
• Tim Holloway
• Carey Brown
• Frits Walraven
• Tim Moores
Bartenders:
• Mikalai Zaikin

Greenhorn
Posts: 14
• Number of slices to send:
Optional 'thank-you' note:
Can you please explain to me why 0xFFFFFFFC = -4.0, and why 0xFFFFFFDF = -33 ? I am having difficulty learning hexadecimal, not to mention negative hexadecimal. Maybe you can recommend a good web site that explains it.
Thanks,
TM

Sheriff
Posts: 4313
• Number of slices to send:
Optional 'thank-you' note:
the trick with hex is to turn into binary (which is actually easier to do than Decimal) -- and then figure out what that binary number is.
So... we've got these 2 numbers: 0xFFFFFFFC and 0xFFFFFFDF

So... now that I've done that one for ya -- can you figure out the other?
Grab a piece of scrap paper and count from 0-15 in binary and that will help you to convert the Hex digits to its binary equivalent.
[ August 19, 2003: Message edited by: Jessica Sant ]

TimD Moore
Greenhorn
Posts: 14
• Number of slices to send:
Optional 'thank-you' note:
That's a big help. I'm not sure if I have it 100% but that well get me going well on my way.
Thanks Alot,
TM

TimD Moore
Greenhorn
Posts: 14
• Number of slices to send:
Optional 'thank-you' note:
Would you mind also explaining how you can go from decimal to hex? Specifically, take the number 1976, how do you come up the hex value?
Thanks,
TM

Jessica Sant
Sheriff
Posts: 4313
• Number of slices to send:
Optional 'thank-you' note:
Decimal to Hex is a little trickier..
BUT -- the good news is, converting Decimal -> Hex is not on the exam. So look into it if you're curious... but don't sweat it. Go study Threads some more, it'll be time better spent.
Bascially you should know that HEX numbers start with 0x, Octal numbers start with 0, Decimal numbers start with anything 1-9. And remember, the x in Ox can be capitalized too -- so OXDEAFCAB is the same as OxDeafCab is the same as Oxdeafcab --

TimD Moore
Greenhorn
Posts: 14
• Number of slices to send:
Optional 'thank-you' note:
OK, thanks again Jess.
TM

Ranch Hand
Posts: 3271
• Number of slices to send:
Optional 'thank-you' note:
In order to convert decimal to any base (hex, octal, or binary), you can continually divide the number by the base. Let me give you an example by converting the number 95 to all 3 bases.
First, we'll do binary:

Now, write down the remainders in reverse order that you got them: 1011111. There you have it - 1011111 is the binary version of 95. Let's try that with hex:

Again, we write down the remainders in reverse order and we have 0x5F, which is the hexadecimal representation of 95. Finally, let's do octal:

That gives us a value of 137, which is the octal representation of 95.
I hope that helps,
Corey

TimD Moore
Greenhorn
Posts: 14
• Number of slices to send:
Optional 'thank-you' note:
Thanks Corey, That does help.
TM

 Don't get me started about those stupid light bulbs.