| 22 | | In package `util` we need to add a class supporting infinite precision rational arithmetic. It will be implemented on top of `BigInteger`: |
| 23 | | * `Rational` /* infinite precision rational numbers */ |
| 24 | | * `static Rational rational(int value);` |
| 25 | | * `static Rational rational(double value);` |
| 26 | | * `static Rational rational(BigInteger value);` |
| 27 | | * `static Rational add(Rational arg0, Rational arg1);` |
| 28 | | * `static Rational subtract(Rational arg0, Rational arg1);` |
| 29 | | * `static Rational multiply(Rational arg0, Rational arg1);` |
| 30 | | * `static Rational divide(Rational arg0, Rational arg1);` |
| 31 | | * `static Rational minus(Rational arg);` |
| 32 | | * `static int compare(Rational arg0, Rational arg1);` /* +-0 */ |
| 33 | | * `boolean isInteger();` |
| 34 | | * `BigInteger intValue();` |
| 35 | | * `BigInteger numerator();` |
| 36 | | * `BigInteger denominator();` |
| 37 | | * `BigInteger floor();` |
| 38 | | * `BigInteger ceil();` |
| 39 | | * `boolean isGT0();` |
| 40 | | * `boolean isGTE0();` |
| 41 | | * `boolean is0();` |
| | 22 | This has been added in a new package `numbers`. There are types `IntegerNumberIF`, `RationalNumberIF`, both of which extend `NumberIF`. There is a `NumberFactoryIF` type for creating numbers, performing operations on them, etc. There is a `RealFactory` implementing `NumberFactoryIF` which provides this perfect precision feature. |