WiiRd forum

Off-topic => Off-topic => Topic started by: doomkaiber001 on October 28, 2010, 06:46:30 AM

Title: Hexadecimals
Post by: doomkaiber001 on October 28, 2010, 06:46:30 AM
Right, I kinda need help with something. I understand the hexadecimals; until it gets to three digits... :( I'd like someone to explain it, thanks. :smileyface:
Title: Re: Hexadecimals
Post by: James0x57 on October 28, 2010, 02:31:11 PM
0xFF = 255
0x100 = 256


Use windows calculator until you figure it out. When I started 11 years ago I was in the same boat and that worked best for me.

Good luck.
Title: Re: Hexadecimals
Post by: doomkaiber001 on October 28, 2010, 03:36:44 PM
I'll try but, judging on those numbers, I'll struggle quite a bit. Thanks for giving me the headstart though!
Title: Re: Hexadecimals
Post by: James0x57 on October 28, 2010, 04:30:23 PM
Start by learning to count in hex. That would help you. Most of us use a calculator (or some other tool) to convert between hex and decimal. Over time you'll memorize handfuls of frequent conversions without trying to.
Title: Re: Hexadecimals
Post by: doomkaiber001 on October 28, 2010, 05:32:50 PM
I think I know a bit about hex. Last night I began writing all the hex's I could do. I managed to get to 9A, and the parts after that. I got a headstart using 'Statman Hexadecimals' (up to 20) and carried on from there. Once I finished, I checked my results to that page, they were all right!
Title: Re: Hexadecimals
Post by: doomkaiber001 on October 28, 2010, 05:40:38 PM
What do you mean anyway by counting in Hex:
This?
0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F  10  11  12  13  14  15  16  17  18  19  1A  1B  1C  1D  1E  1F  20  21...
And so on and so forth.
Title: Re: Hexadecimals
Post by: Link on October 28, 2010, 06:57:28 PM
Quote from: doomkaiber001 on October 28, 2010, 05:40:38 PM
What do you mean anyway by counting in Hex:
This?
0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F  10  11  12  13  14  15  16  17  18  19  1A  1B  1C  1D  1E  1F  20  21...
And so on and so forth.

Exactly this..
Title: Re: Hexadecimals
Post by: doomkaiber001 on October 28, 2010, 07:06:29 PM
Oh, and sorry if that last post was a bit, well, hyper. I am happy though, beyond belief... Anyway I still don't understand how 0xFF equals 255. Enlighten me please?
Title: Re: Hexadecimals
Post by: dcx2 on October 28, 2010, 07:34:17 PM
Hex is a compressed form of binary.

0xF = 1111b

0xC = 1100b

(the lowercase b after a number indicates it is binary)

0xFF = 1111 1111b

Now you just need to learn how to convert base 2 to base 10.

http://www.wikihow.com/Convert-from-Binary-to-Decimal
Title: Re: Hexadecimals
Post by: doomkaiber001 on October 28, 2010, 08:07:43 PM
So... Decimal to Binary
178= 10110010

Binary to decimal
11001110 = 206
Title: Re: Hexadecimals
Post by: doomkaiber001 on October 28, 2010, 08:15:20 PM
So does that make 0xD 1101 and 0xE 1110?
Title: Re: Hexadecimals
Post by: doomkaiber001 on October 28, 2010, 08:21:52 PM
Quote from: dcx2 on October 28, 2010, 07:34:17 PM
Hex is a compressed form of binary.

0xF = 1111b

0xC = 1100b

(the lowercase b after a number indicates it is binary)

0xFF = 1111 1111b

Now you just need to learn how to convert base 2 to base 10.

http://www.wikihow.com/Convert-from-Binary-to-Decimal

So I take it I need to understand Binary to work ot the Hex's following 9A?
Title: Re: Hexadecimals
Post by: James0x57 on October 28, 2010, 08:23:00 PM
Main thanks goes to Link because he said yes? ... *shrugs*


Those binary conversions are correct.



Example to convert straight to decimal from hex:
0x1FA =
(16^2)*1 + (16^1)*0xF + (16^0)*0xA =
256*1 + 16*15 + 1*10 =
256 + 240 + 10 =
506
Title: Re: Hexadecimals
Post by: doomkaiber001 on October 28, 2010, 08:46:38 PM
Forgive me for this noobish question but what exactly does the ^ mean inbetween numbers.
Title: Re: Hexadecimals
Post by: James0x57 on October 28, 2010, 09:51:13 PM
"raised to the power of"
So ^2 means "squared"
16^4 = 16*16*16*16
Title: Re: Hexadecimals
Post by: doomkaiber001 on October 28, 2010, 10:01:09 PM
Oh..! What a mistake. Now that you point it out to me it makes perfect sense... I'm going to try and find an answer to a different Hex.
Title: Re: Hexadecimals
Post by: doomkaiber001 on October 29, 2010, 08:55:53 AM
I think I've got this wrong but;

0x2DA=
(16^2)*2 + (16^1)*0xD + (16^0)*0xA=
512 + 224 + 11 =     747
Title: Re: Hexadecimals
Post by: doomkaiber001 on October 29, 2010, 11:28:20 AM
What do the values of the second number in the brackets rely on?
Title: Re: Hexadecimals
Post by: Nuke on October 29, 2010, 11:37:14 AM
Windows / Mac calculators both have ability to switch from dec,hex,binary. You have to just switch the mode.
Title: Re: Hexadecimals
Post by: doomkaiber001 on October 29, 2010, 01:32:40 PM
Could you check if the following is correct, please?

184 = 10111000
1011 = B
1000 = 8

0xB8

Title: Re: Hexadecimals
Post by: James0x57 on October 29, 2010, 02:18:49 PM
Quote from: doomkaiber001 on October 29, 2010, 01:32:40 PM
Could you check if the following is correct, please?

184 = 10111000
1011 = B
1000 = 8

0xB8
Correct.


Quote from: doomkaiber001 on October 29, 2010, 11:28:20 AM
What do the values of the second number in the brackets rely on?
The powers? They rely on the place of the digit. Counts up from 0 starting on the far right (1's place).


In 'normal' (decimal) math, you say there's a one's place, ten's place, hundred's place, thousand's place etc. (these are powers of 10)
In hex you'd say one's place, 16's place, 256's place, 4096's place etc. (these are powers of 16)
Title: Re: Hexadecimals
Post by: Panda On Smack on October 29, 2010, 02:21:52 PM
just change the view in your calculator as Nuke said:

(http://img149.imageshack.us/img149/517/calcl.png)

That's from Win 7 but it should be similar
Title: Re: Hexadecimals
Post by: doomkaiber001 on October 29, 2010, 02:51:27 PM
I did this all in my head and on paper; thanks for telling me!

Anyway, if the decimal was between 257 and 512 , would it be 1x instead of 0x?
Title: Re: Hexadecimals
Post by: Panda On Smack on October 29, 2010, 03:22:03 PM
the 0x preceding a hex digit doesn't change. That's just to help people differentiate between different types of numbers

The numbers 0 - 255 can be represented by 2 Hex digits and in a rough speaking sense we call this 8bit (8 binary digits)

254 = 0xFE
255 = 0xFF

After FF we go into 16bit which is 4 Hex digits

256 = 0x100
257 = 0x101
...
9999 = 0x270F

then 32bit which is 8 Hex digits

350000000 = 0x14DC9380

and so on

someone else will do a far better job of explaining it
Title: Re: Hexadecimals
Post by: doomkaiber001 on October 29, 2010, 04:29:06 PM
9999=
0010011100001111
0010 = 2
0111 = 7
0000 = 0
1111 = F
0x270F

350000000=
00010100110111001001001110000000
0001 = 1
0100 = 4
1101 = D
1100 = C
1001 = 9
0011 = 3
1000 = 8
0000 = 0
0x14DC9380

I used my head to work out most of this!
Title: Re: Hexadecimals
Post by: doomkaiber001 on October 29, 2010, 04:50:33 PM
Quote from: doomkaiber001 on October 29, 2010, 04:29:06 PM
9999=
0010011100001111
0010 = 2
0111 = 7
0000 = 0
1111 = F
0x270F

350000000=
00010100110111001001001110000000
0001 = 1
0100 = 4
1101 = D
1100 = C
1001 = 9
0011 = 3
1000 = 8
0000 = 0
0x14DC9380

I used my head to work out most of this!


What do you think? :D
Title: Re: Hexadecimals
Post by: doomkaiber001 on October 29, 2010, 04:54:04 PM
Hey James, I've got to say Thank-you. You've helped me all the way through this. You, dude, are amazing! And thanks to Panda on Smack (What kind of name is that anyway?!) for helping me just now.
Title: Re: Hexadecimals
Post by: James0x57 on October 29, 2010, 05:01:10 PM
If you converted 9999 and 350000000 to binary in your head or with a bit of scratch work; you're more dedicated than I am. lol


Like Panda said, it's just a way to show you that it's a different number base, 0x prefix means hex.
110 = decimal 110
0x110 = hex 110
110b = binary 110


edit: no problem =)
Title: Re: Hexadecimals
Post by: doomkaiber001 on October 29, 2010, 05:10:50 PM
Now what to do. How about... I don't know.
Title: Re: Hexadecimals
Post by: IRS on October 29, 2010, 05:45:09 PM
its a common calculator way of writing exponents. he means to take the first number ^ to the power of (next number) so in the case of 100 you would have it done as 16^2 then go on for the rest of the numbers.
Title: Re: Hexadecimals
Post by: doomkaiber001 on October 29, 2010, 06:37:16 PM
Ok... I think I get it. I find it easier to convert decimal to hex easier to do when I also use binary in the middle though. :)