Quasi-comprehensive BigDecimal soundness/correctness fix.

This fixes issues SI-6153, SI-6173, SI-6456, and SI-6699, along with a
number of other similar possible issues.

Relevant changes include
  * Changes to avoid heap explosion when working with BigInt
    - to isWhole
    - to hashCode
    - to equals
    - to BigInt's equals
  * Changes to enable equality matching hashCode
    - Only for sufficiently small BigInt
    - For identical values with different precision
  * Changes to isValidDouble
    - Takes precision into account now
    - New method added to test whether even if the Double is not
      represented exactly, it's the canonical representation
    - New companion methods added to allow exact expansion of
      Double (binary/decimal difference)
  * Changes to constructor
    - Null arguments are not allowed (these can throw NPEs later
      at awkward/unexpected times)
  * New JUnit test to test all these things

These changes are coordinated, for the most part, hence the monolithic
commit.