lib/danica/power.rb in danica-2.0.5 vs lib/danica/power.rb in danica-2.0.6
- old
+ new
@@ -1,18 +1,19 @@
module Danica
class Power < Operator
variables :base, :exponent
+ default_value :is_grouped?, false
def to_f
base.to_f ** exponent.to_f
end
def to_tex
- "#{base.to_tex}^{#{exponent.to_tex}}"
+ "#{wrap_as_group(base).to_tex}^{#{exponent.to_tex}}"
end
def to_gnu
- "#{base.to_gnu}**#{exponent.to_gnu}"
+ "#{ wrap_as_group(base).to_gnu}**(#{exponent.to_gnu})"
end
end
end