Module: Hilbert::Api::LimitApi

Defined in:
lib/hilbert/api/limit_api.rb

Class Method Summary collapse

Class Method Details

.execute(formula, var, close_to) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/hilbert/api/limit_api.rb', line 4

def self.execute(formula, var, close_to)
  case $meta_info.lang
  # TODO: I know what you want to say.......!
  when :ruby
    case close_to
    when 'oo'
      "temp_cal_f(#{var}) <= #{formula};
       temp_cal_f(100000)"
    else
      "temp_cal_f(#{var}) <= #{formula};
       temp_cal_f(#{close_to} + Float::EPSILON ** 20)"
    end
  when :inter
    Dydx::API.reset!
    Dydx::API.store_func(eval(var), eval(formula), :tmp)
    Dydx::API.eval_func(eval(close_to) + Float::EPSILON ** 20, :tmp)
  else
    fail "List is not implemented for #{$meta_info.lang_str}"
  end
end