Hex to dec conversion for large numbers

A

Alex Vinokur

I am looking for an algorithm/method which enables to convert very large
hexadecimal numbers to decimal numbers.

Here is what I would like to do.

string hex_str = "123456789abcdef0.........."
string dec_str = <the same number in decimal represantation>
 
K

Karl Heinz Buchegger

Alex said:
I am looking for an algorithm/method which enables to convert very large
hexadecimal numbers to decimal numbers.

Here is what I would like to do.

string hex_str = "123456789abcdef0.........."
string dec_str = <the same number in decimal represantation>

What I would do:
Get a copy of a Big Integer library.
Then the rest is easy:

Total = 0;
while( hex_digit_available )
Total = Total* 16 + decimal_representation( hex_digit );

Convert Total to a string
 
B

Basil

What I would do:
Get a copy of a Big Integer library.
Then the rest is easy:

Total = 0;
while( hex_digit_available )
Total = Total* 16 + decimal_representation( hex_digit );

Convert Total to a string

Is there Big Integer library - Multiprecision unsigned number template
library (MUNTL).

http://sourceforge.net/projects/muntl/

Big Integer of library have member for convert in to/from hex string.
This is one half of your task.
Unfortunate now it have not member for convert in to/from dec string.
But you can write this convertor himself :) This is very easy.

Thank
Basil
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top