Closed stepthom closed 10 years ago
I implemented BigInteger and BigDecimal in the Fraction class, and added a few new testcases to confirm that the numerator and denominator can handle values larger than Java's 'int' type allows.
Java seems to provide nothing like a pow(...) function for the BigDecimal class. Therefore it's hard to propagate the use of BigDecimal into the operations such as Term.evaluate(...), MathFunction.evaluate(...) and MathFunction.solve(...), where we would have liked to be able to use the extended precision provided by BigDecimal. (This would have been fairly simple if we only allowed our Terms to have integer exponents, but we allow fractional exponents as well.)
(Split from #47. See discussion there for more background.)
Many functions in the
Fraction
class have the ability to overflow or underflow. Modify the package to useBigInt
instead of integers/longs andBigDecimal
instead of floats/doubles.Please add some tests that test cases that would cause overflow to be sure they are handled correctly.