#### Archived

This topic is now archived and is closed to further replies.

# decimal to hex

## Recommended Posts

redneckCoder    122
The assembly tutorial I read, this first on the x86 assmebly list in "Articles and Resources" shows decimal to binary, binary to decimal, and binary to hex conversions. What I need to know is how to convert decimal to hex without having to convert it to binary first. How do I do this? Thanks. -AJ C:\DOS C:\DOS\RUN RUN\DOS\RUN -Comic Book Store Guy''s t-shirt that I saw on the Simpsons, although it didn''t actually come from the Simpsons. http://vdsoft.netfirms.com/home.html

##### Share on other sites
Guest Anonymous Poster
From decimal to hex divide by 16.

##### Share on other sites
redneckCoder    122
Even though I don''t know how to do the conversion, I''m fairly certain it isn''t a simple divide by 16. Anyone have the real answer? Thanks.

-AJ

C:\DOS
C:\DOS\RUN
RUN\DOS\RUN

-Comic Book Store Guy''s t-shirt that I saw on the Simpsons, although it didn''t actually come from the Simpsons.

http://vdsoft.netfirms.com/home.html

##### Share on other sites
ElCrazon    308
Well I don''t know how your supposed to do it but I just multiply the first number by 16 and add the second number. I.E. 3F= (3 * 16) + 15.

##### Share on other sites
masonium    118
you can use the same procedure that you use to convert to base 2, only apply it to base 16. First find the highest power of 16 that is <= the number you are converting. Then divide that into the number, which becomes the first digit. Take the remainder and the next lowest power of 16 and divide, repeat etc.

For example, take the number 456. The highest power is 16^2, which is 256. 456 / 256 = 1 R 200. The first digit is 1. 200 / 16^1 is 12 R 8, so the next digit is C. The last digit is 8 since that's all you have left at 16^0. So 456 base 10 == 1C8 base 16.

BTW ElCrazon -> that's hex to decimal and the question was decimal to hex

No, HTML is not an OO language.

[edited by - masonium on April 30, 2002 9:22:37 PM]