rational-compare: Rational Number Comparisons

rational-compareR Documentation

Rational Number Comparisons

Description

Rational Number Comparisons

Usage

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

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

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

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

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

## S3 method for class 'rationalS3'
Ops(e1, e2)

## S3 method for class 'rationalR6'
Ops(e1, e2)

## S3 method for class ''rational::rationalS7''
Ops(e1, e2, ...)

Arguments

e1

rational numbers, integers, or numerics

e2

rational numbers, integers, or numerics

...

Additional arguments

Note

Dispatch happens in 3 steps

  • 1. Ops.rational::rationalS7

  • 2. S7_Ops generic

  • 3. rationalS7 method for S7_Ops with the right signature

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))
a <- rational(1L, 3L, "S7")
b <- rational(3L, 4L, "S7")
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))

bertcarnell/rational documentation built on Aug. 1, 2024, 8:14 p.m.