Class: FloatTangentInstruction

Inherits:
Instruction show all
Defined in:
lib/instructions/float/float_tangent.rb

Overview

pops the top item of the :float stack; pushes a ValuePoint with its tangent onto the :float stack

needs: 1 :float

pushes: 1 :float

Instance Attribute Summary

Attributes inherited from Instruction

#context

Instance Method Summary collapse

Methods inherited from Instruction

all_instructions, #go, inherited, #initialize, #needs, #pushes, to_nudgecode

Constructor Details

This class inherits a constructor from Instruction

Instance Method Details

#cleanupObject



19
20
21
# File 'lib/instructions/float/float_tangent.rb', line 19

def cleanup
  pushes :float, @result
end

#deriveObject



16
17
18
# File 'lib/instructions/float/float_tangent.rb', line 16

def derive
  @result = ValuePoint.new("float", Math.tan(@arg1))
end

#preconditions?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/instructions/float/float_tangent.rb', line 10

def preconditions?
  needs :float, 1
end

#setupObject



13
14
15
# File 'lib/instructions/float/float_tangent.rb', line 13

def setup
  @arg1 = @context.pop_value(:float)
end