d2jsp
Log InRegister
d2jsp Forums > Off-Topic > General Chat > Science, Technology & Nature > Need Help With Hex To Base 10
Add Reply New Topic New Poll
Member
Posts: 465
Joined: Jul 6 2015
Gold: 29.02
Jun 25 2016 07:21pm
ok so i have school homeowork and i am stumped on this

i have to convert 2AF9 ( hex power of 16) to either a base of 10 or 2 and show my work... i am not sure how to do that i have been looking on youtube and stuff and can not figure it out
can anyone help me out please!
Member
Posts: 6,065
Joined: Aug 20 2006
Gold: 31,660.34
Jun 25 2016 07:25pm
9+(15*16)+(10*16^2)+(2*16^3)

also: http://forums.d2jsp.org/forum.php?f=257

This post was edited by Cellmat on Jun 25 2016 07:26pm
Member
Posts: 465
Joined: Jul 6 2015
Gold: 29.02
Jun 25 2016 07:26pm
so i was just over thinking it... so all you did was add the numbers that A and F represented correct ?
Member
Posts: 10,812
Joined: Oct 15 2009
Gold: Locked
Warn: 20%
Jun 25 2016 07:37pm
basically that is what he did..

Another way of looking at it is

9*16^0 + 15*16^1 + 10*16^2 + 2*16^3

This works for any base btw... for each digit, write out its value in base 10 then multiply it by the base it came from (16 in this case), raised to the power of the location of the digit (the first digit on the far right is the 0's location) then sum them all up.
Member
Posts: 28,331
Joined: Jun 9 2007
Gold: 11,700.00
Jun 25 2016 07:37pm
Quote (dogwillhunt34 @ 26 Jun 2016 01:26)
so i was just over thinking it... so all you did was add the numbers that A and F represented correct ?


don't forget the multiplication with powers of 16 depending on the position

postscript:

1. 'Azrad' got in just a fraction of a second earlier :D
2. for questions like this, the right sub-forum is http://forums.d2jsp.org/forum.php?f=257

This post was edited by brmv on Jun 25 2016 07:40pm
Member
Posts: 465
Joined: Jul 6 2015
Gold: 29.02
Jun 25 2016 08:07pm
i needed it in binary so i figured it out so that would look like this

0010 1010 1111 1001^2

i appreciate it guys
Member
Posts: 10,812
Joined: Oct 15 2009
Gold: Locked
Warn: 20%
Jun 25 2016 11:34pm
hex to binary and binary to hex are much easier actually. It is because 2^4 = 16
which means 4 digits of binary (which can represent 0-15 decimal) convert exactly to 1 digit of hex (which also represents 0-15 decimal)

So for hex - > binary you can just convert each digit to binary in place, then concatenate (just mash them together) everything, just make sure you include 4 digits of binary for each digit (add 0's if you need them to make 4):

2AF9 -> 0010 1010 1111 1001 (just like you got)

This will not work with base 10 because there 3 digits of binary isn't enough to represent 0-9, and 4 digits of binary is too much (it is more than just 0-9).

In fact, I suspect the reason base 16 was invented/used is because of this property it has with base 2 (and at the most primitive level, computers use base 2), which allows you to easily compress a bunch of binary into something more readable for humans.
Member
Posts: 52,972
Joined: Aug 20 2008
Gold: 14,100.00
Jun 27 2016 03:09pm
Wat
Go Back To Science, Technology & Nature Topic List
Add Reply New Topic New Poll