Is that lower case output or uper case?
Eg does it start ac7b08a or does it start AC7B08A?
The first 40 of the 830483 hex digits are as follows:
Code: Select all
$ node fiboFast.js | head -c 40
$ ./fiboFast | head -c 40
$ ./fiboFast | head -n 1 | md5sum
$ ./fiboFast | head -n 1 | sha256sum
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
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 .