Sha256: 7a0d715c362a2227912ac267b2cd809ac002e47107b419ccda750487a1f476d0
Contents?: true
Size: 756 Bytes
Versions: 5
Compression:
Stored size: 756 Bytes
Contents
module Qlang module Iq class Dydx::Algebra::Formula # FIX: def to_q str = to_s.gsub(/\*\*/, '^').rm(' * ') str.equalize! end end def self.execute(code) ruby_code = Q.to_ruby.compile(code) ruby_obj = eval(ruby_code) optimize_output(ruby_obj) rescue SyntaxError # TODO: emergency case ruby_code when /(\d)+(\w)/ execute("#{$1} * #{$2}") end end def self.optimize_output(ruby_obj) case ruby_obj when Matrix, Vector, Dydx::Algebra::Formula ruby_obj.to_q when Float::INFINITY 'oo' when - Float::INFINITY '-oo' else str = ruby_obj.to_s str.equalize! end end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
qlang-0.0.27182000 | lib/qlang/iq.rb |
qlang-0.0.27180000 | lib/qlang/iq.rb |
qlang-0.0.27100000 | lib/qlang/iq.rb |
qlang-0.0.27000000 | lib/qlang/iq.rb |
qlang-0.0.27 | lib/qlang/iq.rb |