1

I am currently working with bignums in C and want to convert to String/print out very large decimal points of hexadecimal.

E.g.: 2.B7E151628AED2A6ABF7158809CF4F3C762E7160F38B4DA56A784D9045190CFEF324E7738926CFBE5F4BF8D8D8C31D763DA06C80ABB1185EB4F7C7B5757F5958490CFD47D7C19BB42158D9554F7B46BCED55C4D79FD5F24D6613C31C3839A2DDF8A9A276BCFBFA1C877C56284DAB79CD4C2B3293D20E9E5EAF02AC60ACC93ECEB

would become

2.71828182845904523536028747135266249775724709369995957496696762772407663035354759457138217852516642742746639193200305992181741359662904357290033429526059563073813232862794349076323382988075319525101901157383418793070215408914993488416750924476146066808226480016847741185374234544243710753907774499206955170

Can somebody help me on that? I already looked at the following post: How do I convert a very long binary number to decimal?.

But it does not help me, because the fractional conversion does not work for me.

I tried out the algorithm described in How do I convert a very long binary number to decimal?. But it does not work for me.

!Also: I found much help about the conversion of the part that is before the dot, but what interests me is the conversion of the fractional part

Dano_R
  • 11
  • 2

1 Answers1

0
  1. Multiply the fractional part by ten.
  2. Separate the integer part and fractional part of that.
  3. The integer part is your next decimal digit.
  4. Go to step 1.

As for when to stop, if you have n hexadecimal digits, then you can get floor(n log(16)/log(10)) decimal digits out of that.

Though your last three hexadecimal digits of e are wrong. They should be d87 instead of ceb.

Mark Adler
  • 101,978
  • 13
  • 118
  • 158