Added an external library for arbitrary precision maths and modified the
existing code to make use of that library. Fixed minor bugs.