Rational Number Comparisons

# S4 method for rationalS4,numeric
Compare(e1, e2)

# S4 method for rationalS4,integer
Compare(e1, e2)

# S4 method for numeric,rationalS4
Compare(e1, e2)

# S4 method for integer,rationalS4
Compare(e1, e2)

# S4 method for rationalS4,rationalS4
Compare(e1, e2)

# S3 method for rationalS3
Ops(e1, e2)

# S3 method for rationalR6
Ops(e1, e2)

Arguments

e1

rational numbers, integers, or numerics

e2

rational numbers, integers, or numerics

Examples

a <- rational(1L, 3L, "S3") b <- rational(3L, 4L, "S3") d <- 3L e <- 20.1 stopifnot(a != b) stopifnot(!(a == b)) stopifnot(a < b) stopifnot(!(a > b)) stopifnot(a <= b) stopifnot(!(a >= b)) stopifnot(a != d) stopifnot(!(a == d)) stopifnot(a < d) stopifnot(!(a > d)) stopifnot(a <= d) stopifnot(!(a >= d)) stopifnot(a != e) stopifnot(!(a == e)) stopifnot(a < e) stopifnot(!(a > e)) stopifnot(a <= e) stopifnot(!(a >= e)) a <- rational(1L, 3L, "R6") b <- rational(3L, 4L, "R6") d <- 3L e <- 20.1 stopifnot(a != b) stopifnot(!(a == b)) stopifnot(a < b) stopifnot(!(a > b)) stopifnot(a <= b) stopifnot(!(a >= b)) stopifnot(a != d) stopifnot(!(a == d)) stopifnot(a < d) stopifnot(!(a > d)) stopifnot(a <= d) stopifnot(!(a >= d)) stopifnot(a != e) stopifnot(!(a == e)) stopifnot(a < e) stopifnot(!(a > e)) stopifnot(a <= e) stopifnot(!(a >= e))