Sha256: c06e5eff828e44d79d1532b32dbc14e82485e9197087c9daec1bc247e3beb483

Contents?: true

Size: 429 Bytes

Versions: 3

Compression:

Stored size: 429 Bytes

Contents

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

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