Sha256: 66e81bb20ccf110b34f382d5fd346adefd04743d451512c4fd98d657031fc6cb

Contents?: true

Size: 465 Bytes

Versions: 3

Compression:

Stored size: 465 Bytes

Contents

# pops the top 2 items of the +:float+ stack;
# pushes a ValuePoint with their sum onto the +:float+ stack
#
# *needs:* 2 +:float+
#
# *pushes:* 1 +:float+
#

class FloatAddInstruction < Instruction
  def preconditions?
    needs :float, 2
  end
  def setup
    @arg1 = @context.pop_value(:float)
    @arg2 = @context.pop_value(:float)
  end
  def derive
    @result = ValuePoint.new("float", @arg1 + @arg2)
  end
  def cleanup
    pushes :float, @result
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nudge-0.2.9 lib/instructions/float/float_add.rb
nudge-0.2.8 lib/instructions/float/float_add.rb
nudge-0.2.7 lib/instructions/float/float_add.rb