Hi,
does anybody know if any "equation" or some sort does exist when you want to convert e.g. some hexadecimal number to decimal without using calculator?
Equations to convert hex, bin and oct from decimal
Equations to convert hex, bin and oct from decimal
My web site: http://inflater.wz.cz (Slovak)
Derrick operating system: http://derrick.xf.cz (Slovak and English )
Derrick operating system: http://derrick.xf.cz (Slovak and English )
Re: Equations to convert hex, bin and oct from decimal
to convert to any base, simply find the representation of the base to convert from in the base to convert to. For example, this means that if you want to convert from base-16 to base-8, this number would be 20 and base-8 to base-10 would 8. Then simply, multiply each digit of the number from right-to-left by the former number raised to consecutive powers starting at 0.
For example, converting 0x7EA6 from base-16 to base-8 would yield the following:
(7 * (20 ^ 3)) + (16 * (20 ^ 2)) + (12 * (20 ^ 1)) + (6 * (20 ^ 0)) ==
(7 * 10000) + (16 * 400) + (12 * 20) + 6 = 70000 + 7000 + 240 + 6 = 77246
similarly, converting 0x7EA6 from base-16 to base-10 would be:
(7 * (16 ^ 3)) + (14 * (16 ^ 2)) + (10 * (16 ^ 1)) + (6 * (16 ^ 0)) ==
(7 * 4096) + (14 * 256) + (10 * 16) + 6 = 28672 + 3584 + 160 + 6 = 32256 + 166 = 32422
For example, converting 0x7EA6 from base-16 to base-8 would yield the following:
(7 * (20 ^ 3)) + (16 * (20 ^ 2)) + (12 * (20 ^ 1)) + (6 * (20 ^ 0)) ==
(7 * 10000) + (16 * 400) + (12 * 20) + 6 = 70000 + 7000 + 240 + 6 = 77246
similarly, converting 0x7EA6 from base-16 to base-10 would be:
(7 * (16 ^ 3)) + (14 * (16 ^ 2)) + (10 * (16 ^ 1)) + (6 * (16 ^ 0)) ==
(7 * 4096) + (14 * 256) + (10 * 16) + 6 = 28672 + 3584 + 160 + 6 = 32256 + 166 = 32422
-
- Member
- Posts: 566
- Joined: Tue Jun 20, 2006 9:17 am
Re: Equations to convert hex, bin and oct from decimal
binary to hex and binary to oct are very easy
For hex - form groups of 4 n convert to hex
for oct - form groups of 3 n convert to oct
eg
1000 0111 binary = 87 hex
eg
For
111 100 binary = 74 octal
Generalizing the above formula :
hexadecimal to decimal = Summmation from i = 0 to n ai *( 16 ^ i )
ie ai is the i th hex digit in decimal
i varies from zero to n where n is the total number of digits -1
For hex - form groups of 4 n convert to hex
for oct - form groups of 3 n convert to oct
eg
1000 0111 binary = 87 hex
eg
For
111 100 binary = 74 octal
Generalizing the above formula :
hexadecimal to decimal = Summmation from i = 0 to n ai *( 16 ^ i )
ie ai is the i th hex digit in decimal
i varies from zero to n where n is the total number of digits -1