Sha256: 0f1a15bc4542ffe951ea0dc6b474eb58d9d115480dad17fc93a140db6537f957

Contents?: true

Size: 531 Bytes

Versions: 3

Compression:

Stored size: 531 Bytes

Contents

# pops the top 2 items of the +:float+ stack;
# pushes a new ValuePoint onto the +:bool+ stack,
# with value +true+ if the second one is strictly less than the top one
#
# *needs:* 2 +:float+
#
# *pushes:* 1 +:bool+
#

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

Version data entries

3 entries across 3 versions & 1 rubygems

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