4 Jun 2013 (updated 4 Jun 2013 at 23:22 UTC)
»
For anyone who wants to implement an arbitrary-precision integer library, the best technique (I'll argue) is to use simple strings and base256 encoding, gulped at word-sized intervals, dependent on machine architecture. On a 64-bit machine, that means we get to calculate 8 bytes at a time! Kickass.
Techniques for translating back and forth between base256 and base10 (for user I/O) are simple and well-known, but all the calculations will be done at near native CPU integer speed with minimal effort between gulps. Of course, things should be implemented with an eye for good cache performance.
For "floating point" or real-number arithmetic, a simple Rational class/struct implemented with two BigInts (numerator and denominator) can create a lossless, full-browed, real-number library.
Let me know if this is redundant.