Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Computer Certification > A+ Certification > Hexidecimal conversion

Reply
Thread Tools

Hexidecimal conversion

 
 
Gordon Findlay
Guest
Posts: n/a
 
      11-09-2003
On Sat, 08 Nov 2003 15:15:24 GMT, Tom MacIntyre
<(E-Mail Removed)> wrote:

>On Fri, 7 Nov 2003 22:08:27 -0700, "Mark Stinson" <m
>(E-Mail Removed)> wrote:
>
>>There is the formula that I learned back in my skool daze, but it was a
>>royal pain, involved memorizing powers of 16 and doing a lot of math (which
>>may be why I learned it in a math class). Today, I convert decimal to
>>binary, then start from the right, split the binary into groups of four
>>digits and convert each group to one hex digit:
>>
>>38,463 = 1001 0110 0011 1111
>>
>>1001 0110 0011 1111
>> 9 6 3 F
>>
>>Alternatively (and more commonly), I open calc.exe in scientific mode, enter
>>my decimal number, click "hex" and viola!
>>
>>But if you really insist on doing it the hard way:
>>
>>The largest power of 16 that can be subtracted from 38,463 without getting a
>>negative result is 4096, so
>>
>>38,463 / 4096 = 9 with 1599 remainder
>>
>>1599 / 256 = 6 with 63 remainder
>>
>>63 / 16 = 3 with 15 remainder
>>
>>15 / 1 = 15 (F in hex) with 0 remainder
>>
>>So 38,463 = 963F
>>
>>And now you also know why you learned remainders in your math classes.


Since division is repeated subtraction, don't bother remembering
powers of 16. Stick with the same divisor throughout

1: Take a decimal number
2: Divide by 16 - record, then ignore (for now) the remainder
3: Repeat step 2 until you have a number which is less than 16.
4: Start with that number, then write down the remainders in reverse
order to their generation. Convert remainders 10 - 15 to A - F of
course.

Voila!

Dead easy to program too - no need for a lookup table of poowers of
16.

[I learnt this method in school over 40 years ago. The education
system isn't getting any better]

Gordon
 
Reply With Quote
 
 
 
 
B
Guest
Posts: n/a
 
      11-09-2003
try this chart

to convert hex to bin find the hex number. the number on the top row is its
first 2 digits in bin. the left row is its last two digits in binary. for
example hex number 6 first 2 digits in binary would be 01 and second two
would be 10 making 0110. It could also be used in reverse to convert hex to
bin.

00 01 10 11
00 0 4 8 C
01 1 5 9 D
10 2 6 A E
11 3 7 B F



"Gordon Findlay" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On Sat, 08 Nov 2003 15:15:24 GMT, Tom MacIntyre
> <(E-Mail Removed)> wrote:
>
> >On Fri, 7 Nov 2003 22:08:27 -0700, "Mark Stinson" <m
> >(E-Mail Removed)> wrote:
> >
> >>There is the formula that I learned back in my skool daze, but it was a
> >>royal pain, involved memorizing powers of 16 and doing a lot of math

(which
> >>may be why I learned it in a math class). Today, I convert decimal to
> >>binary, then start from the right, split the binary into groups of four
> >>digits and convert each group to one hex digit:
> >>
> >>38,463 = 1001 0110 0011 1111
> >>
> >>1001 0110 0011 1111
> >> 9 6 3 F
> >>
> >>Alternatively (and more commonly), I open calc.exe in scientific mode,

enter
> >>my decimal number, click "hex" and viola!
> >>
> >>But if you really insist on doing it the hard way:
> >>
> >>The largest power of 16 that can be subtracted from 38,463 without

getting a
> >>negative result is 4096, so
> >>
> >>38,463 / 4096 = 9 with 1599 remainder
> >>
> >>1599 / 256 = 6 with 63 remainder
> >>
> >>63 / 16 = 3 with 15 remainder
> >>
> >>15 / 1 = 15 (F in hex) with 0 remainder
> >>
> >>So 38,463 = 963F
> >>
> >>And now you also know why you learned remainders in your math classes.

>
> Since division is repeated subtraction, don't bother remembering
> powers of 16. Stick with the same divisor throughout
>
> 1: Take a decimal number
> 2: Divide by 16 - record, then ignore (for now) the remainder
> 3: Repeat step 2 until you have a number which is less than 16.
> 4: Start with that number, then write down the remainders in reverse
> order to their generation. Convert remainders 10 - 15 to A - F of
> course.
>
> Voila!
>
> Dead easy to program too - no need for a lookup table of poowers of
> 16.
>
> [I learnt this method in school over 40 years ago. The education
> system isn't getting any better]
>
> Gordon



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting a hexidecimal string to a floating point array Bushido Hacks C++ 15 05-04-2005 07:17 PM
How can I create hexidecimal colour codes from pickies? Air Rider HTML 7 11-27-2004 01:31 PM
Coverting Ascii Hexidecimal Number JVSFugitive Java 3 11-03-2004 04:07 PM
Shadow BIOS in RAM and hexidecimal representation? Will Hay A+ Certification 1 03-02-2004 10:39 PM
outputing hexidecimal using cout daniel aviad galron C++ 3 10-13-2003 01:31 AM



Advertisments