Feb 15 2008

Decimal fraction to Base 16 conversion problem

If you're new here, you may want to start with my most popular posts. Then, subscribe to my RSS feed to stay updated. Thanks for visiting!

Recently a reader (Omar) left some comments on my post about base conversion involving a fraction. I will attempt to help him out in this post. This may clear up some problems for any other folks that may be having base conversion trouble.

Omar writes:

“Convert the following number to from decimal to hexadecimal, stop at 4 decimal points
a. 0.6640625
b. 0.3333
c. 69/256″

When dealing with floating point numbers or fractions, I find it best to use the multiplication method to figure out the conversion. The method outlined below will work for any conversion from a decimal fraction to another base. I will use Part a. as an example.

-First, multiply the original base 10 number (0.6640625) by the base you are trying to convert to.
0.6640625 * 16 = 10.62500

-”10″ is one digit in the base 16 conversion. However, we know there is no digit “10″ in base 16. We change this to “A” (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F) Write down “A” for one of the base 16 digits.

-Next, take the remainder from the first product (0.62500) and multiply it by your goal base again.
0.62500 * 16 = 10

-It looks like “10″ is the other digit in the base 16 conversion. We know what to do with this. Write down “A” for the other base 16 digit.

-If we had another remainder we would keep going with the same pattern of (remainder * 16). However, the last remainder came out to an even “10″ or “A”.

-Now to represent the answer take the bottom hex digit and work your way back up to the first digit you converted and write it like so.
0.6640625 in Hexadecimal = 0.AA

That’s it! You can now convert from a fraction to any other base using the same method. Don’t forget to keep your decimal point when writing the final result. I will be helping Omar with some of his other problems in future posts. Happy Base Converting!

Technorati Tags: , , ,

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

11 Comments on this post

Trackbacks

  1. omar said:

    tanx for the help me
    ;)

    February 16th, 2008 at 2:24 am
  2. Ayze said:

    nyc!! dis helped me a lot!! we have an exam tommorow and im so lucky to find this site!!! ^^

    July 14th, 2008 at 4:24 am
  3. hstagner said:

    Hello Ayze,

    I am so glad that I could help you. Let me know how the exam goes!

    Regards,

    Harley Stagner

    July 14th, 2008 at 10:21 am
  4. Ahmad said:

    Weldone! It is a simple way to understand fractional conversion

    September 10th, 2008 at 5:01 am
  5. Azzam said:

    That’s awesome man you helped me alot i give all the respect buddy

    October 20th, 2009 at 9:41 pm
  6. JD said:

    Good stuff, My teacher seemed to have skipped this for some reason (although I probably should be reading the book)

    Thanks!

    May 31st, 2010 at 10:30 pm
  7. prosanta said:

    it’s really fantastic. Helps lot for the solution finder

    July 28th, 2010 at 5:11 am
  8. vishal said:

    thanks a lot. but some time a remainder continues again and again. like irrational number. so when we should stop our multiplication to remainder by 16. getting confuse. need help..

    December 17th, 2010 at 6:18 am
  9. zul said:

    Thanks dude..

    January 19th, 2011 at 9:59 am
  10. John Ortiz said:

    Thanks for this. It’s clear.

    July 27th, 2011 at 11:19 am
  11. prudvi said:

    thanks for this ,and more anther information is give me for understanding

    November 3rd, 2011 at 1:07 am

LEAVE A COMMENT

Subscribe Form

Subscribe to Blog

Sponsors

Recent Readers

JOIN MY COMMUNITY!
                  Computers Blogs - Blog Top Sites