Skip to main content
formatting headers and adding some details.
Source Link

Community wiki?: "Quick conversion / output of high precision values"

Option A.)

Option A.) why not engage the professionals instead of re-inventing the wheel?
"mpdecimal": "pow 2 200000" from the examples in libmpdec ( vanilla-C version ):

./pow 2 200000   
time: 0.004088

9980051818471209560859346309213505420041...  

"..." stands for many!!! more digits. AFAIK the time is for calculation and! output.

Option B.)

Option B.) If you insist to write yourself: the code for mpdecimal is open source and straightforward, also available as libmpdec++C++ version "libmpdec++", in my opinion it is allowed to spy and copy from there. ( Note the license and refer to the source, crediting Stefan Krah. )

Wisdom:

Wisdom: mpdecimal avoids "multi bit arithmetic" by storing values in "chunks" of 19 decimal digits which can be handled with 64-bit arithmetic.

Option C.)

Option C.) If you insist in using your own datatype: for output use "multi-bit arithmetic" to split in 19-digit chunks, then use 64-bit arithmetic to extract from these chunks.

Wisdom II:

Wisdom II: the splitting algorithm - despite somewhat complicated to root specific divisors - also works / speeds up conversions to other roots which are not "pow-2s".

Community wiki?: "Quick conversion / output of high precision values"

Option A.) why not engage the professionals instead of re-inventing the wheel?
"mpdecimal": "pow 2 200000" from the examples in libmpdec ( vanilla-C version ):

./pow 2 200000   
time: 0.004088

9980051818471209560859346309213505420041...  

"..." stands for many!!! more digits. AFAIK the time is for calculation and! output.

Option B.) If you insist to write yourself: the code for mpdecimal is open source and straightforward, also available as libmpdec++, in my opinion it is allowed to spy and copy from there.

Wisdom: mpdecimal avoids "multi bit arithmetic" by storing values in "chunks" of 19 decimal digits which can be handled with 64-bit arithmetic.

Option C.) If you insist in using your own datatype: for output use "multi-bit arithmetic" to split in 19-digit chunks, then use 64-bit arithmetic to extract from these chunks.

Wisdom II: the splitting algorithm - despite somewhat complicated - also works / speeds up conversions to other roots which are not "pow-2s".

Community wiki?: "Quick conversion / output of high precision values"

Option A.)

why not engage the professionals instead of re-inventing the wheel?
"mpdecimal": "pow 2 200000" from the examples in libmpdec ( vanilla-C version ):

./pow 2 200000   
time: 0.004088

9980051818471209560859346309213505420041...  

"..." stands for many!!! more digits. AFAIK the time is for calculation and! output.

Option B.)

If you insist to write yourself: the code for mpdecimal is open source and straightforward, also available as C++ version "libmpdec++", in my opinion it is allowed to spy and copy from there. ( Note the license and refer to the source, crediting Stefan Krah. )

Wisdom:

mpdecimal avoids "multi bit arithmetic" by storing values in "chunks" of 19 decimal digits which can be handled with 64-bit arithmetic.

Option C.)

If you insist in using your own datatype: for output use "multi-bit arithmetic" to split in 19-digit chunks, then use 64-bit arithmetic to extract from these chunks.

Wisdom II:

the splitting algorithm - despite somewhat complicated to root specific divisors - also works / speeds up conversions to other roots which are not "pow-2s".

Source Link

Community wiki?: "Quick conversion / output of high precision values"

Option A.) why not engage the professionals instead of re-inventing the wheel?
"mpdecimal": "pow 2 200000" from the examples in libmpdec ( vanilla-C version ):

./pow 2 200000   
time: 0.004088

9980051818471209560859346309213505420041...  

"..." stands for many!!! more digits. AFAIK the time is for calculation and! output.

Option B.) If you insist to write yourself: the code for mpdecimal is open source and straightforward, also available as libmpdec++, in my opinion it is allowed to spy and copy from there.

Wisdom: mpdecimal avoids "multi bit arithmetic" by storing values in "chunks" of 19 decimal digits which can be handled with 64-bit arithmetic.

Option C.) If you insist in using your own datatype: for output use "multi-bit arithmetic" to split in 19-digit chunks, then use 64-bit arithmetic to extract from these chunks.

Wisdom II: the splitting algorithm - despite somewhat complicated - also works / speeds up conversions to other roots which are not "pow-2s".