Arithmetic/Rational/Java: Difference between revisions
no edit summary
(Looks for common denominator when adding/subtracting) |
No edit summary |
||
Line 1:
Modeled after BigInteger/BigDecimal. Instances of this class are immutable, and simplified upon construction. The returned numerator() and denominator() are never negative; the sign can be retrieved via signum(). The denominator for zero is always 1 (e.g. 0/5 is simplified to 0/1), and signed zeros are not supported (e.g. 0/-1 is simplified to 0/1).
<
import java.math.BigInteger;
import java.math.RoundingMode;
Line 480:
}
</syntaxhighlight>
|