Sha256: fbe1a886b59de0a498ebe1f45571663f95c44cdf03bdebf2b2867262cead7c6f

Contents?: true

Size: 410 Bytes

Versions: 4

Compression:

Stored size: 410 Bytes

Contents

module Danica
  class Operator::Power < Operator
    variables :base, :exponent
    default_value :is_grouped?, false

    def to_f
      base.to_f ** exponent.to_f
    end

    def to_tex(**options)
      "#{wrap_as_group(base).to_tex(options)}^{#{exponent.to_tex(options)}}"
    end

    def to_gnu(**options)
      "#{ wrap_as_group(base).to_gnu(options)}**(#{exponent.to_gnu(options)})"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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