Sha256: 3977f8a18fb4c13038c543004d3c42a3297c52284f3fba2cd6bf6bf897e74a9a

Contents?: true

Size: 487 Bytes

Versions: 1

Compression:

Stored size: 487 Bytes

Contents

module Danica
  class Function
    class Power < Function
      attr_reader :base, :exponent

      def to_f
        base.to_f ** exponent.to_f
      end

      def base=(value)
        @base = wrap_value(value)
      end

      def exponent=(value)
        @exponent = wrap_value(value)
      end

      private

      def tex_string
        "#{base.to_tex}^{#{exponent.to_tex}}"
      end

      def gnu_string
        "#{base.to_gnu}**#{exponent.to_gnu}"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
danica-1.0.0 lib/danica/function/power.rb