Sha256: 02da4e3ccec178df9aa42b5e6824e4828ea3f0206c68e40ea7419c05bbe378df

Contents?: true

Size: 428 Bytes

Versions: 3

Compression:

Stored size: 428 Bytes

Contents

# pops the top item of the +:float+ stack;
# pushes a ValuePoint with its absolute value onto the +:float+ stack
#
# *needs:* 1 +:float+
#
# *pushes:* 1 +:float+
#

class FloatAbsInstruction < Instruction
  def preconditions?
    needs :float, 1
  end
  def setup
    @arg1 = @context.pop_value(:float)
  end
  def derive
    @result = ValuePoint.new("float", @arg1.abs)
  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_abs.rb
nudge-0.2.8 lib/instructions/float/float_abs.rb
nudge-0.2.7 lib/instructions/float/float_abs.rb