# Super Large Integer Math Calculations

7 messages
Open this post in threaded view
|
Report Content as Inappropriate

## Super Large Integer Math Calculations

Open this post in threaded view
|
Report Content as Inappropriate

## Re: Super Large Integer Math Calculations

 On 7/7/17, [hidden email] <[hidden email]> wrote: > For integers beyond 64 bit, or even beyond 32 bit on a 64 bit machine, > why can't the math be broken down into peices the way a human does it on > paper, and then theoretically any number can be added and subtracted, > even if it is beyond 32/64 bit? > > Example: > > type TSuperLargeInt = string; > > var >    i, j: TSuperLargeInt; >    output: TSuperLargeInt; > begin >    i := '100000000000000000009'; >    j := '100000000000000000001'; >    output := AddLargeInts(i,j); >    writeln(output); > end. http://svn.code.sf.net/p/flyingsheep/code/trunk/wtf/ncalc.pp does exactly that (all dependenies are also found at http://svn.code.sf.net/p/flyingsheep/code/trunk/wtf). It can handle integers (and only integers) up to 2GB digits with absolut precision. It can handle GoogolPlex. Calculate 9^99 with absolute precision: 29512665430652752148753480226197736314359272517043832886063884637676943433478020332709411004889 Fac(100)? 93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000 It's not lightning fast, but there is room for optimization I guess. Bart _______________________________________________ fpc-pascal maillist  -  [hidden email] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Open this post in threaded view
|
Report Content as Inappropriate

## Re: Super Large Integer Math Calculations

 In reply to this post by noreply Bart <[hidden email]> wrote: > On 7/7/17, [hidden email] <[hidden email]> wrote: > >> For integers beyond 64 bit, or even beyond 32 bit on a 64 bit machine, >> why can't the math be broken down into peices the way a human does it on >> paper, and then theoretically any number can be added and subtracted, >> even if it is beyond 32/64 bit? >> >> Example: >> >> type TSuperLargeInt = string; >> >> var >>     i, j: TSuperLargeInt; >>     output: TSuperLargeInt; >> begin >>     i := '100000000000000000009'; >>     j := '100000000000000000001'; >>     output := AddLargeInts(i,j); >>     writeln(output); >> end. > http://svn.code.sf.net/p/flyingsheep/code/trunk/wtf/ncalc.pp does exactly that > (all dependenies are also found at > http://svn.code.sf.net/p/flyingsheep/code/trunk/wtf). > > It can handle integers (and only integers) up to 2GB digits with > absolut precision. > It can handle GoogolPlex. > > Calculate 9^99 with absolute precision: > 29512665430652752148753480226197736314359272517043832886063884637676943433478020332709411004889 > > Fac(100)? > 93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000 > > It's not lightning fast, but there is room for optimization I guess. > > Bart Great! I knew someone must have made that! I needed this a few months ago, but resorted to Python at that time. Now I can use FPC next time. :) /Ingemar _______________________________________________ fpc-pascal maillist  -  [hidden email] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Open this post in threaded view
|
Report Content as Inappropriate

## Re: Super Large Integer Math Calculations

 In reply to this post by Bart-48 On 2017-07-07 17:08, Bart wrote: > On 7/7/17, [hidden email] <[hidden email]> wrote: > >> For integers beyond 64 bit, or even beyond 32 bit on a 64 bit machine, >> why can't the math be broken down into peices the way a human does it >> on >> paper, and then theoretically any number can be added and subtracted, >> even if it is beyond 32/64 bit? >> >> Example: >> >> type TSuperLargeInt = string; >> >> var >>    i, j: TSuperLargeInt; >>    output: TSuperLargeInt; >> begin >>    i := '100000000000000000009'; >>    j := '100000000000000000001'; >>    output := AddLargeInts(i,j); >>    writeln(output); >> end. > > http://svn.code.sf.net/p/flyingsheep/code/trunk/wtf/ncalc.pp does > exactly that > (all dependenies are also found at > http://svn.code.sf.net/p/flyingsheep/code/trunk/wtf). ... > It's not lightning fast, but there is room for optimization I guess. > > Bart I knew someone had already invented this! Any idea if it does square roots, and, decimal point numbers too.. Or, what math can it "not" do.. things like sin/tan/cos, or strange maths.. Probably a complex question requiring a complex answer _______________________________________________ fpc-pascal maillist  -  [hidden email] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Open this post in threaded view
|
Report Content as Inappropriate

## Re: Super Large Integer Math Calculations

 Have a look at http://www.wolfgang-ehrhardt.de/ On 2017-07-11 6:05 AM, [hidden email] wrote: On 2017-07-07 17:08, Bart wrote: On 7/7/17, [hidden email] [hidden email] wrote: For integers beyond 64 bit, or even beyond 32 bit on a 64 bit machine, why can't the math be broken down into peices the way a human does it on paper, and then theoretically any number can be added and subtracted, even if it is beyond 32/64 bit? Example: type TSuperLargeInt = string; var    i, j: TSuperLargeInt;    output: TSuperLargeInt; begin    i := '100000000000000000009';    j := '100000000000000000001';    output := AddLargeInts(i,j);    writeln(output); end. http://svn.code.sf.net/p/flyingsheep/code/trunk/wtf/ncalc.pp does exactly that (all dependenies are also found at http://svn.code.sf.net/p/flyingsheep/code/trunk/wtf). ... It's not lightning fast, but there is room for optimization I guess. Bart I knew someone had already invented this! Any idea if it does square roots, and, decimal point numbers too.. Or, what math can it "not" do.. things like sin/tan/cos, or strange maths.. Probably a complex question requiring a complex answer _______________________________________________ fpc-pascal maillist  -  [hidden email] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal _______________________________________________ fpc-pascal maillist  -  [hidden email] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Open this post in threaded view
|
Report Content as Inappropriate

## Re: Super Large Integer Math Calculations

 On 2017-08-10 22:45, Stuart Cox wrote: > Have a look at http://www.wolfgang-ehrhardt.de/> Thanks, looks interesting! I could not find the maximum supported length of a number (multi gigabyte?) or number string though.. i.e. for big numbers, but how big? Big is a vague term :-) It might be mentioned somewhere on his pages, I just couldn't find it yet _______________________________________________ fpc-pascal maillist  -  [hidden email] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal