require 'rational' require 'mathn' rat = Rational(25/100) # => 1/4 -- lowest terms rat.inspect # => "1/4" rat.to_s # => "1/4" rat.to_f # => 0.25 p rat # => 1/4