Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Rational(var numerator: Int = 0, var denominator: Int = 1) {
- constructor(n: Long = 0L, d: Long = 0L) : this(n.toInt(), d.toInt())
- constructor(n: BigInteger = BigInteger.ZERO,
- d: BigInteger = BigInteger.ONE) : this(n.toInt(), d.toInt())
- }
- infix fun Int.divBy(d: Int): Rational {
- return Rational(this, d)
- }
- infix fun Long.divBy(d: Long): Rational {
- return Rational(this, d = d)
- }
- infix fun BigInteger.divBy(d: BigInteger): Rational {
- return Rational(this, d = d)
- }
- operator fun Rational.contains(range: IntRange): Boolean {
- return false
- }
- operator fun Rational.rangeTo(r: Rational): {
- return this..r
- }
- fun String.toRational(): Rational {
- return Rational(0, 1)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement