Sha256: d3620e1479a8dbf30322d7a515d6834c14ade2ac4920a7723724b5902b01f9cc

Contents?: true

Size: 451 Bytes

Versions: 3

Compression:

Stored size: 451 Bytes

Contents

module Danica
  class Operator::Division < Operator
    variables :numerator, :denominator
    default_value :priority, 3
    default_value :is_grouped?, true

    def to_f
      numerator.to_f / denominator.to_f
    end

    def to_tex(**options)
      "\\frac{#{numerator.to_tex(options)}}{#{denominator.to_tex(options)}}"
    end

    def to_gnu(**options)
      "(#{numerator.to_gnu(options)})/(#{denominator.to_gnu(options)})"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
danica-2.7.4 lib/danica/operator/division.rb
danica-2.7.3 lib/danica/operator/division.rb
danica-2.7.2 lib/danica/operator/division.rb