Class: AppMath::Sin

Inherits:
Object
  • Object
show all
Defined in:
lib/graph.rb

Overview

Function objects for testing Graph#draw_func with functions for which the precision of function evaluation is enforced. This enforced precison is set with the creation of the function object.

Instance Method Summary collapse

Constructor Details

#initialize(n = R.prec) ⇒ Sin

Returns a new instance of Sin.



294
295
296
297
# File 'lib/graph.rb', line 294

def initialize(n = R.prec)
  @precMem = R.prec
  @precLoc = n
end

Instance Method Details

#at(x) ⇒ Object



299
300
301
302
303
# File 'lib/graph.rb', line 299

def at(x)
  R.prec = @precLoc
  y = R.c(x).sin
  R.prec = @precMem; y
end