L1VM - big num math

With my mpfr C++ big number math module you can calculate with real big numbers. I just wanted to know how many combinations there are using a 4096 bit key for encryption.

The calculation is simple:

combinations = 2 ^ 4096

With normal calculator apps it is likely to get a “infinity” result! But I wanted to know the answer. Here is a simple Brackets program using my mpfr C++ big numbers module:

// math-bignum.l1com
// mpfr math bignum library demo
//
// 2 ^ 4096 = 
//
#include <intr.l1h>
(main func)
	(set int64 1 zero 0)
	(set int64 1 baseaddr 0)
	(set int64 1 potaddr 1)
	(set int64 1 resaddr 2)
	(set int64 1 outaddr 3)
	(set string s basestr "2.0")
	(set string s potstr "4096.0")
	(set string s resstr "0.0")
	(set string s formatstr "%.20Ff")
	(set string 4096 outstr "")
	(set string s mathcalcstr "2 ^ 4096 =")
	(set int64 1 outstr_len 4095)
	(set int64 1 one 1)
	(set int64 1 base 10)
	(set int64 1 precision 50)
	(set int64 1 f 0)
	(zero :mp_math_init call)
    print_s (mathcalcstr)
    print_n
    // set variable base
    (basestr base baseaddr :mp_set_float !)
    // set pot num
    (potstr base potaddr :mp_set_float !)
    (baseaddr potaddr resaddr :mp_pow_float !)
    // convert result to string 
    (resaddr outstraddr outstr_len formatstr precision :mp_prints_float !)
    print_s (outstr)
    print_n
    exit (zero)
(funcend)
#include <mpfr-lib-auto.l1h>

And here is the result:

$ l1vm prog/math-bignum -q
2 ^ 4096 =
10443888814131525066917527107166243825799642490473837803842334832839539079715574568488268
11934997558340890106714439262837987573438185793607263236087851365277945956976543709998340
36159013438371831442807001185594622637631883939771274567233468434458661749680790870580370
40712840487401186091144679777835980290066869389768817877859469056301902609405995794534328
23469303026696443059025015972399867714215541693835559885291486318237914434496734087811872
63949647510018904134900841706167509366833385055103297208826955076998361636941193301521379
68258371880918336567512213184928463681255502259983004123447848625956744921946170238065059
13245610825731835380087608622102834270197698202313169017678006675195485079921636419370285
37512478401490715913545998279051339961155179427110683113409058427288427979155484978295432
35345170652232690613949059876930021229633956877828789484406160074129456749198230505716423
77154816321380631045902916136926708342856440730447899971901781465763473223850267253059899
79599609079946920177462481771844986745565925017832907047311943316555080756822184657174637
32968849128195203174570024409266169108741483850784119298045229818573389776481031260859030
01302413467189726673216491511131602920781738033436090243804708340403154190336.00000000000