DavidS,

Is that lower case output or uper case?

Lower case.

Eg does it start ac7b08a or does it start AC7B08A?

Neither.

The first 40 of the 830483 hex digits are as follows:

Code: Select all

```
$ node fiboFast.js | head -c 40
1d543d8cd48be3ac139b8751944afda3a607c116
$ ./fiboFast | head -c 40
1d543d8cd48be3ac139b8751944afda3a607c116
$ ./fiboFast | head -n 1 | md5sum
9f4f03ed9084412b4e57461e8b9870d0 -
$ ./fiboFast | head -n 1 | sha256sum
ee09a5c7cd0ac5884386cefd4ac78dc377f60ad180815169ed3d01d76f934385 -
```

One limit of BASIC is that using the builtin print to print hex without any conversion in between produces uper case hex, hence the question.

No worries. Just run the output through tr. For example:

Code: Select all

```
$ ./fiboFast | head -n 1 | tr '[:upper:]' '[:lower:]'
```

Working with extremely large numbers can be a challenge...

Yes but, PeterO did big fibos above using 58 year old language running on a 60 year old computer architecture. It's a beautiful piece of code. Do take a look, it employs what I think is a neat trick...

The elements of PeterO's big integer arrays are in base 100,000,000,000. He does a carry when 100,000,000,000 is overflowed. That means when it comes time to print the big number he only needs to print the elements as normal decimal integers, with leading zero suppression, one after the other. No messing around with binary bases or hex conversions. It's much quicker to convert and print those elements in decimal one at a time than deal with converting the array as a whole from binary to ASCII decimal

Brilliant!

Of course PeterO can work in base 100,000,000,000 because the Eliot 803 had a 39-bit word length! We would have to use base 1,000,000,000 on 32 bit machines.

We can learn a thing or two from the old times!

How do you not know how to do this and yet you claim that you have done it in C?

Despite my awesome powers, if I were to write all this big integer maths stuff myself it would take all year, be huge, ugly, complicated and buggy. I ain't going there unless under duress.

Unless you are calling C with a non-standard library C (which I would dissagree with).

So of course I'm using a library. libgmp. It would be silly not to.

Memory in C++ is a leaky abstraction .