Simplified algorithm and expanded numeric range support.

This update changes the algorithm to use an array selection to
determine the base instead of the obfuscated nested conditional
operator.   Additioinally, the C++ version uses type 'long int' now to
extend the upper bound of serial numbers (on some systems).  The upper
bound is now stated in the documentation in the JavaScript version as
well.  Better exception checking was added in the decode-verification
check (shouldn't be needed, but just in case).