[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.javascript

Improve speed calculations?

JT

1/10/2016 1:33:00 PM

<script language="Javascript">

/*ADD TWO VARIABLES USING CHOSEN BASE*/
function naiveAdd(base, arrOne, addTwo)
{
addOne=arrOne.slice();
//addTwo=arrTwo.slice();
abigArr = addOne.length;
asmallArr = addTwo.length;
addResult = [];
remainder = 0;
for (i = 0; i < asmallArr; i ++ )
{

addOne[i] = addOne[i] + addTwo[i] + remainder;
if (addOne[i] >= base)
{

addOne[i] = addOne[i] - base;
remainder = 1;

}
else
{
remainder = 0;
}
}
// If strings of equal length but there is a remainder;
while (remainder == 1 && addOne[i]==(base-1))
{
addOne[i] = 0;
i++;
}
if (remainder == 1) {if (isNaN(addOne[i])) addOne[i] = 0; addOne[i] = addOne[i]+1;}
return addOne;
}

/* COMPARE SIZE OF TWO ARRAYS, IF A < B RETURN TRUE, IF B >= A RETURN FALSE */
function lessThan(A, B)
{
var AA = A.length;
var BB = B.length;
if(AA > BB) return false;
if(AA < BB) return true;
// AA = BB, compare indexes from biggest to smallest.
for(i = AA - 1; i >= 0; i -- )
{
if(A[i] < B[i]) return true;
if(A[i] > B[i]) return false;
}
return false;
}

/* ORDER THE ARRAYS SO THE BIGGER IS PASSED AS FIRST ARGUMENT*/
function orderArrayAdd(Abase, A, B)
{
return lessThan(A, B) ? counterArr = naiveAdd(Abase, B, A) : counterArr = naiveAdd(Abase, A, B);
}

/* GET VALUES FROM INPUT*/
function fetchValues(){
base=document.eval.FBASE.value;
myeval = document.eval.expression.value;
lucasStart = document.eval.start.value;
lStart=parseInt(lucasStart)
lucasScope = document.eval.scope.value;
lScope=parseInt(lucasScope)
}

/* PARSE VALUES FROM INPUT */
function parseToInt(){
if (result = myeval.indexOf("+") != - 1)
{
opArr = myeval.split("+");
operation = "+";
}
arrOne = opArr[0].split("").map(Number).reverse();
arrTwo = opArr[1].split("").map(Number).reverse();
}


function main(){
document.eval.result.value="";
document.eval.timing.value="";

base=2;
evalStr="";
var out=[];counter=1;
fetchValues();
parseToInt();
flip=0;
/* TIMER START */
var start = new Date().getTime();
lEnd=lStart+lScope;

while(counter<=lEnd){
out=orderArrayAdd(base,arrOne,arrTwo);
arrOne=arrTwo.slice();
arrTwo=out.slice();
if (counter>=lStart && counter<lEnd) {fib=out.slice();evalStr+=counter+"th "+fib.reverse().join('')+"\n";}
counter++;
}
/* TIMER END */
var end = new Date().getTime();
var time = end - start;
document.eval.result.value+=evalStr;
document.eval.timing.value+=time;
} </script>

<html><body onLoad="main()";>
<H1>FIBONACCI AND OTHER SERIES</H1>
<form name="eval" onsubmit="main(); return false;">
<input type="submit" value="Generate"><input type="text" name="timing" value="" size="4"> ms BASE<input type="text" name="FBASE" value="2" size="2"><br>
Start print x'th number in Serie<input type="text" name="start" value="1" size="9"> How many follwing in Serie -><input type="text" name="scope" value="777" size="9"><br>
Generate Serie expansons using startvalues<input type="text" name="expression" value="1+1" size="10"><br>
Result <textarea name="result" cols="100" rows="30"></textarea><br>


</form>
</body></html>
9 Answers

JT

1/11/2016 11:19:00 AM

0

Den söndag 10 januari 2016 kl. 14:33:27 UTC+1 skrev jonas.t...@gmail.com:
> <script language="Javascript">
>
> /*ADD TWO VARIABLES USING CHOSEN BASE*/
> function naiveAdd(base, arrOne, addTwo)
> {
> addOne=arrOne.slice();
> //addTwo=arrTwo.slice();
> abigArr = addOne.length;
> asmallArr = addTwo.length;
> addResult = [];
> remainder = 0;
> for (i = 0; i < asmallArr; i ++ )
> {
>
> addOne[i] = addOne[i] + addTwo[i] + remainder;
> if (addOne[i] >= base)
> {
>
> addOne[i] = addOne[i] - base;
> remainder = 1;
>
> }
> else
> {
> remainder = 0;
> }
> }
> // If strings of equal length but there is a remainder;
> while (remainder == 1 && addOne[i]==(base-1))
> {
> addOne[i] = 0;
> i++;
> }
> if (remainder == 1) {if (isNaN(addOne[i])) addOne[i] = 0; addOne[i] = addOne[i]+1;}
> return addOne;
> }
>
> /* COMPARE SIZE OF TWO ARRAYS, IF A < B RETURN TRUE, IF B >= A RETURN FALSE */
> function lessThan(A, B)
> {
> var AA = A.length;
> var BB = B.length;
> if(AA > BB) return false;
> if(AA < BB) return true;
> // AA = BB, compare indexes from biggest to smallest.
> for(i = AA - 1; i >= 0; i -- )
> {
> if(A[i] < B[i]) return true;
> if(A[i] > B[i]) return false;
> }
> return false;
> }
>
> /* ORDER THE ARRAYS SO THE BIGGER IS PASSED AS FIRST ARGUMENT*/
> function orderArrayAdd(Abase, A, B)
> {
> return lessThan(A, B) ? counterArr = naiveAdd(Abase, B, A) : counterArr = naiveAdd(Abase, A, B);
> }
>
> /* GET VALUES FROM INPUT*/
> function fetchValues(){
> base=document.eval.FBASE.value;
> myeval = document.eval.expression.value;
> lucasStart = document.eval.start.value;
> lStart=parseInt(lucasStart)
> lucasScope = document.eval.scope.value;
> lScope=parseInt(lucasScope)
> }
>
> /* PARSE VALUES FROM INPUT */
> function parseToInt(){
> if (result = myeval.indexOf("+") != - 1)
> {
> opArr = myeval.split("+");
> operation = "+";
> }
> arrOne = opArr[0].split("").map(Number).reverse();
> arrTwo = opArr[1].split("").map(Number).reverse();
> }
>
>
> function main(){
> document.eval.result.value="";
> document.eval.timing.value="";
>
> base=2;
> evalStr="";
> var out=[];counter=1;
> fetchValues();
> parseToInt();
> flip=0;
> /* TIMER START */
> var start = new Date().getTime();
> lEnd=lStart+lScope;
>
> while(counter<=lEnd){
> out=orderArrayAdd(base,arrOne,arrTwo);
> arrOne=arrTwo.slice();
> arrTwo=out.slice();
> if (counter>=lStart && counter<lEnd) {fib=out.slice();evalStr+=counter+"th "+fib.reverse().join('')+"\n";}
> counter++;
> }
> /* TIMER END */
> var end = new Date().getTime();
> var time = end - start;
> document.eval.result.value+=evalStr;
> document.eval.timing.value+=time;
> } </script>
>
> <html><body onLoad="main()";>
> <H1>FIBONACCI AND OTHER SERIES</H1>
> <form name="eval" onsubmit="main(); return false;">
> <input type="submit" value="Generate"><input type="text" name="timing" value="" size="4"> ms BASE<input type="text" name="FBASE" value="2" size="2"><br>
> Start print x'th number in Serie<input type="text" name="start" value="1" size="9"> How many follwing in Serie -><input type="text" name="scope" value="777" size="9"><br>
> Generate Serie expansons using startvalues<input type="text" name="expression" value="1+1" size="10"><br>
> Result <textarea name="result" cols="100" rows="30"></textarea><br>
>
>
> </form>
> </body></html>

http://jt.node365.se/BAUT...

Using the biggest base possible adding "4503599627370495" encoding fibonacci in javascript without overflow.

Also fixed ambiguity reading out the numbers in bases over ten by using separator for digitplaces. The add can not cause overflow but to get rid of base overflow would require some real deep thinking.

The 100000th Fibonacci took 34 seconds i do not think i can get it much faster in javascript if your a wizard please prove me wrong.

http://jt.node365.se/BAUT...

JT

1/11/2016 12:42:00 PM

0

Den måndag 11 januari 2016 kl. 12:19:12 UTC+1 skrev jonas.t...@gmail.com:
> Den söndag 10 januari 2016 kl. 14:33:27 UTC+1 skrev jonas.t...@gmail.com:
> > <script language="Javascript">
> >
> > /*ADD TWO VARIABLES USING CHOSEN BASE*/
> > function naiveAdd(base, arrOne, addTwo)
> > {
> > addOne=arrOne.slice();
> > //addTwo=arrTwo.slice();
> > abigArr = addOne.length;
> > asmallArr = addTwo.length;
> > addResult = [];
> > remainder = 0;
> > for (i = 0; i < asmallArr; i ++ )
> > {
> >
> > addOne[i] = addOne[i] + addTwo[i] + remainder;
> > if (addOne[i] >= base)
> > {
> >
> > addOne[i] = addOne[i] - base;
> > remainder = 1;
> >
> > }
> > else
> > {
> > remainder = 0;
> > }
> > }
> > // If strings of equal length but there is a remainder;
> > while (remainder == 1 && addOne[i]==(base-1))
> > {
> > addOne[i] = 0;
> > i++;
> > }
> > if (remainder == 1) {if (isNaN(addOne[i])) addOne[i] = 0; addOne[i] = addOne[i]+1;}
> > return addOne;
> > }
> >
> > /* COMPARE SIZE OF TWO ARRAYS, IF A < B RETURN TRUE, IF B >= A RETURN FALSE */
> > function lessThan(A, B)
> > {
> > var AA = A.length;
> > var BB = B.length;
> > if(AA > BB) return false;
> > if(AA < BB) return true;
> > // AA = BB, compare indexes from biggest to smallest.
> > for(i = AA - 1; i >= 0; i -- )
> > {
> > if(A[i] < B[i]) return true;
> > if(A[i] > B[i]) return false;
> > }
> > return false;
> > }
> >
> > /* ORDER THE ARRAYS SO THE BIGGER IS PASSED AS FIRST ARGUMENT*/
> > function orderArrayAdd(Abase, A, B)
> > {
> > return lessThan(A, B) ? counterArr = naiveAdd(Abase, B, A) : counterArr = naiveAdd(Abase, A, B);
> > }
> >
> > /* GET VALUES FROM INPUT*/
> > function fetchValues(){
> > base=document.eval.FBASE.value;
> > myeval = document.eval.expression.value;
> > lucasStart = document.eval.start.value;
> > lStart=parseInt(lucasStart)
> > lucasScope = document.eval.scope.value;
> > lScope=parseInt(lucasScope)
> > }
> >
> > /* PARSE VALUES FROM INPUT */
> > function parseToInt(){
> > if (result = myeval.indexOf("+") != - 1)
> > {
> > opArr = myeval.split("+");
> > operation = "+";
> > }
> > arrOne = opArr[0].split("").map(Number).reverse();
> > arrTwo = opArr[1].split("").map(Number).reverse();
> > }
> >
> >
> > function main(){
> > document.eval.result.value="";
> > document.eval.timing.value="";
> >
> > base=2;
> > evalStr="";
> > var out=[];counter=1;
> > fetchValues();
> > parseToInt();
> > flip=0;
> > /* TIMER START */
> > var start = new Date().getTime();
> > lEnd=lStart+lScope;
> >
> > while(counter<=lEnd){
> > out=orderArrayAdd(base,arrOne,arrTwo);
> > arrOne=arrTwo.slice();
> > arrTwo=out.slice();
> > if (counter>=lStart && counter<lEnd) {fib=out.slice();evalStr+=counter+"th "+fib.reverse().join('')+"\n";}
> > counter++;
> > }
> > /* TIMER END */
> > var end = new Date().getTime();
> > var time = end - start;
> > document.eval.result.value+=evalStr;
> > document.eval.timing.value+=time;
> > } </script>
> >
> > <html><body onLoad="main()";>
> > <H1>FIBONACCI AND OTHER SERIES</H1>
> > <form name="eval" onsubmit="main(); return false;">
> > <input type="submit" value="Generate"><input type="text" name="timing" value="" size="4"> ms BASE<input type="text" name="FBASE" value="2" size="2"><br>
> > Start print x'th number in Serie<input type="text" name="start" value="1" size="9"> How many follwing in Serie -><input type="text" name="scope" value="777" size="9"><br>
> > Generate Serie expansons using startvalues<input type="text" name="expression" value="1+1" size="10"><br>
> > Result <textarea name="result" cols="100" rows="30"></textarea><br>
> >
> >
> > </form>
> > </body></html>
>
> http://jt.node365.se/BAUT...
>
> Using the biggest base possible adding "4503599627370495" encoding fibonacci in javascript without overflow.
>
> Also fixed ambiguity reading out the numbers in bases over ten by using separator for digitplaces. The add can not cause overflow but to get rid of base overflow would require some real deep thinking.
>
> The 100000th Fibonacci took 34 seconds i do not think i can get it much faster in javascript if your a wizard please prove me wrong.
>
> http://jt.node365.se/BAUT...

Oh it seem a bug slipped in. Just 5 seconds for the 100000th fibonacci and 40 seconds for the 1 million th. But it seem it is bigger than windows clipboard handle.

http://jt.node365.se/fibo...

Ben Bacarisse

1/11/2016 1:28:00 PM

0

jonas.thornvall@gmail.com writes:

> Den söndag 10 januari 2016 kl. 14:33:27 UTC+1 skrev jonas.t...@gmail.com:
>> <script language="Javascript">
<snip code>
> http://jt.node365.se/BAUT...
>
> Using the biggest base possible adding "4503599627370495" encoding
> fibonacci in javascript without overflow.
>
> Also fixed ambiguity reading out the numbers in bases over ten by
> using separator for digitplaces. The add can not cause overflow but to
> get rid of base overflow would require some real deep thinking.
>
> The 100000th Fibonacci took 34 seconds i do not think i can get it
> much faster in javascript if your a wizard please prove me wrong.

I have not tried your code, but I've just written a quick bignum add
function and I can get fib(100000) in about 3.5 seconds. If I have time
to unravel yours, I'll do a comparative test. Note that a language with
a good bignum type (Haskell, for example) will do it in less than 100th
of a second.

Note that your 'challenge' makes it easy to optimise the code. For
example, using a power of 10 as the base makes the conversion for
printing very simple.

--
Ben.

Silvio

1/11/2016 2:41:00 PM

0

On 01/11/2016 02:28 PM, Ben Bacarisse wrote:
> jonas.thornvall@gmail.com writes:
>
>> Den söndag 10 januari 2016 kl. 14:33:27 UTC+1 skrev jonas.t...@gmail.com:
>>> <script language="Javascript">
> <snip code>
>> http://jt.node365.se/BAUT...
>>
>> Using the biggest base possible adding "4503599627370495" encoding
>> fibonacci in javascript without overflow.
>>
>> Also fixed ambiguity reading out the numbers in bases over ten by
>> using separator for digitplaces. The add can not cause overflow but to
>> get rid of base overflow would require some real deep thinking.
>>
>> The 100000th Fibonacci took 34 seconds i do not think i can get it
>> much faster in javascript if your a wizard please prove me wrong.
>
> I have not tried your code, but I've just written a quick bignum add
> function and I can get fib(100000) in about 3.5 seconds. If I have time
> to unravel yours, I'll do a comparative test. Note that a language with
> a good bignum type (Haskell, for example) will do it in less than 100th
> of a second.
>
> Note that your 'challenge' makes it easy to optimise the code. For
> example, using a power of 10 as the base makes the conversion for
> printing very simple.
>

That is well neigh impossible if you used a 10-based decimal since Jonas
uses a huge base and is convinced that using a larger base will make
computations much faster. Your result would invalidate that claim...

JT

1/11/2016 2:49:00 PM

0

Den måndag 11 januari 2016 kl. 14:28:20 UTC+1 skrev Ben Bacarisse:
> jonas.thornvall@gmail.com writes:
>
> > Den söndag 10 januari 2016 kl. 14:33:27 UTC+1 skrev jonas.t...@gmail.com:
> >> <script language="Javascript">
> <snip code>
> > http://jt.node365.se/BAUT...
> >
> > Using the biggest base possible adding "4503599627370495" encoding
> > fibonacci in javascript without overflow.
> >
> > Also fixed ambiguity reading out the numbers in bases over ten by
> > using separator for digitplaces. The add can not cause overflow but to
> > get rid of base overflow would require some real deep thinking.
> >
> > The 100000th Fibonacci took 34 seconds i do not think i can get it
> > much faster in javascript if your a wizard please prove me wrong.
>
> I have not tried your code, but I've just written a quick bignum add
> function and I can get fib(100000) in about 3.5 seconds. If I have time
> to unravel yours, I'll do a comparative test. Note that a language with
> a good bignum type (Haskell, for example) will do it in less than 100th
> of a second.
>
> Note that your 'challenge' makes it easy to optimise the code. For
> example, using a power of 10 as the base makes the conversion for
> printing very simple.
>
> --
> Ben.

Yes a bug slipped in so i did get back to old version, those damn javascript arrays so stupid behaviour.
I also get around 3 seconds, and i also check for printouts.
Can you get Fibonacci 1 milling in 360 seconds using base 10?
http://jt.node365.se/fibo...

https://drive.google.com/file/d/0B7yuU1puYuVMSER6dXdEN3NDRUk/view?pref=2...

Ben Bacarisse

1/11/2016 3:44:00 PM

0

Silvio <silvio@internet.com> writes:

> On 01/11/2016 02:28 PM, Ben Bacarisse wrote:
>> jonas.thornvall@gmail.com writes:
>>
>>> Den söndag 10 januari 2016 kl. 14:33:27 UTC+1 skrev jonas.t...@gmail.com:
>>>> <script language="Javascript">
>> <snip code>
>>> http://jt.node365.se/BAUT...
>>>
>>> Using the biggest base possible adding "4503599627370495" encoding
>>> fibonacci in javascript without overflow.
>>>
>>> Also fixed ambiguity reading out the numbers in bases over ten by
>>> using separator for digitplaces. The add can not cause overflow but to
>>> get rid of base overflow would require some real deep thinking.
>>>
>>> The 100000th Fibonacci took 34 seconds i do not think i can get it
>>> much faster in javascript if your a wizard please prove me wrong.
>>
>> I have not tried your code, but I've just written a quick bignum add
>> function and I can get fib(100000) in about 3.5 seconds. If I have time
>> to unravel yours, I'll do a comparative test. Note that a language with
>> a good bignum type (Haskell, for example) will do it in less than 100th
>> of a second.
>>
>> Note that your 'challenge' makes it easy to optimise the code. For
>> example, using a power of 10 as the base makes the conversion for
>> printing very simple.
>>
>
> That is well neigh impossible if you used a 10-based decimal since
> Jonas uses a huge base and is convinced that using a larger base will
> make computations much faster. Your result would invalidate that
> claim...

Using base 10 is quite slow (my code needs 23s for fib(100000) using
base 10), but I use a higher power of 10 as the base for speed whilst
keeping printing simple. With higher powers, you do get faster results
(up to a limit, of course!).

--
Ben.

JT

1/11/2016 3:53:00 PM

0

Den måndag 11 januari 2016 kl. 16:44:32 UTC+1 skrev Ben Bacarisse:
> Silvio <silvio@internet.com> writes:
>
> > On 01/11/2016 02:28 PM, Ben Bacarisse wrote:
> >> jonas.thornvall@gmail.com writes:
> >>
> >>> Den söndag 10 januari 2016 kl. 14:33:27 UTC+1 skrev jonas.t...@gmail.com:
> >>>> <script language="Javascript">
> >> <snip code>
> >>> http://jt.node365.se/BAUT...
> >>>
> >>> Using the biggest base possible adding "4503599627370495" encoding
> >>> fibonacci in javascript without overflow.
> >>>
> >>> Also fixed ambiguity reading out the numbers in bases over ten by
> >>> using separator for digitplaces. The add can not cause overflow but to
> >>> get rid of base overflow would require some real deep thinking.
> >>>
> >>> The 100000th Fibonacci took 34 seconds i do not think i can get it
> >>> much faster in javascript if your a wizard please prove me wrong.
> >>
> >> I have not tried your code, but I've just written a quick bignum add
> >> function and I can get fib(100000) in about 3.5 seconds. If I have time
> >> to unravel yours, I'll do a comparative test. Note that a language with
> >> a good bignum type (Haskell, for example) will do it in less than 100th
> >> of a second.
> >>
> >> Note that your 'challenge' makes it easy to optimise the code. For
> >> example, using a power of 10 as the base makes the conversion for
> >> printing very simple.
> >>
> >
> > That is well neigh impossible if you used a 10-based decimal since
> > Jonas uses a huge base and is convinced that using a larger base will
> > make computations much faster. Your result would invalidate that
> > claim...
>
> Using base 10 is quite slow (my code needs 23s for fib(100000) using
> base 10), but I use a higher power of 10 as the base for speed whilst
> keeping printing simple. With higher powers, you do get faster results
> (up to a limit, of course!).
>
> --
> Ben.

Is the limit of base for search x'th fiboniacci x/2 or square root x? I was thinking x/2 as the ideal base?

JT

1/11/2016 3:56:00 PM

0

Den måndag 11 januari 2016 kl. 16:44:32 UTC+1 skrev Ben Bacarisse:
> Silvio <silvio@internet.com> writes:
>
> > On 01/11/2016 02:28 PM, Ben Bacarisse wrote:
> >> jonas.thornvall@gmail.com writes:
> >>
> >>> Den söndag 10 januari 2016 kl. 14:33:27 UTC+1 skrev jonas.t...@gmail.com:
> >>>> <script language="Javascript">
> >> <snip code>
> >>> http://jt.node365.se/BAUT...
> >>>
> >>> Using the biggest base possible adding "4503599627370495" encoding
> >>> fibonacci in javascript without overflow.
> >>>
> >>> Also fixed ambiguity reading out the numbers in bases over ten by
> >>> using separator for digitplaces. The add can not cause overflow but to
> >>> get rid of base overflow would require some real deep thinking.
> >>>
> >>> The 100000th Fibonacci took 34 seconds i do not think i can get it
> >>> much faster in javascript if your a wizard please prove me wrong.
> >>
> >> I have not tried your code, but I've just written a quick bignum add
> >> function and I can get fib(100000) in about 3.5 seconds. If I have time
> >> to unravel yours, I'll do a comparative test. Note that a language with
> >> a good bignum type (Haskell, for example) will do it in less than 100th
> >> of a second.
> >>
> >> Note that your 'challenge' makes it easy to optimise the code. For
> >> example, using a power of 10 as the base makes the conversion for
> >> printing very simple.
> >>
> >
> > That is well neigh impossible if you used a 10-based decimal since
> > Jonas uses a huge base and is convinced that using a larger base will
> > make computations much faster. Your result would invalidate that
> > claim...
>
> Using base 10 is quite slow (my code needs 23s for fib(100000) using
> base 10), but I use a higher power of 10 as the base for speed whilst
> keeping printing simple. With higher powers, you do get faster results
> (up to a limit, of course!).
>
> --
> Ben.

What timing for the 1 million th Ben?

JT

1/11/2016 4:29:00 PM

0

Den måndag 11 januari 2016 kl. 16:44:32 UTC+1 skrev Ben Bacarisse:
> Silvio <silvio@internet.com> writes:
>
> > On 01/11/2016 02:28 PM, Ben Bacarisse wrote:
> >> jonas.thornvall@gmail.com writes:
> >>
> >>> Den söndag 10 januari 2016 kl. 14:33:27 UTC+1 skrev jonas.t...@gmail.com:
> >>>> <script language="Javascript">
> >> <snip code>
> >>> http://jt.node365.se/BAUT...
> >>>
> >>> Using the biggest base possible adding "4503599627370495" encoding
> >>> fibonacci in javascript without overflow.
> >>>
> >>> Also fixed ambiguity reading out the numbers in bases over ten by
> >>> using separator for digitplaces. The add can not cause overflow but to
> >>> get rid of base overflow would require some real deep thinking.
> >>>
> >>> The 100000th Fibonacci took 34 seconds i do not think i can get it
> >>> much faster in javascript if your a wizard please prove me wrong.
> >>
> >> I have not tried your code, but I've just written a quick bignum add
> >> function and I can get fib(100000) in about 3.5 seconds. If I have time
> >> to unravel yours, I'll do a comparative test. Note that a language with
> >> a good bignum type (Haskell, for example) will do it in less than 100th
> >> of a second.
> >>
> >> Note that your 'challenge' makes it easy to optimise the code. For
> >> example, using a power of 10 as the base makes the conversion for
> >> printing very simple.
> >>
> >
> > That is well neigh impossible if you used a 10-based decimal since
> > Jonas uses a huge base and is convinced that using a larger base will
> > make computations much faster. Your result would invalidate that
> > claim...
>
> Using base 10 is quite slow (my code needs 23s for fib(100000) using
> base 10), but I use a higher power of 10 as the base for speed whilst
> keeping printing simple. With higher powers, you do get faster results
> (up to a limit, of course!).
>
> --
> Ben.

How about using "a real bignumb library" and binary, what will happen?