Comparable operator on rational numbers
#!/usr/bin/env ruby require 'rational' require 'mathn' rat = Rational(25/100) # => 1/4 -- lowest terms rat <=> 1/4 # => 0 rat <=> 1/8 # => 1 rat <=> 1/2 # => -1