qlang 0.0.27182121 → 0.0.27182122

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 456c8d3f8543f42ede24cddf63aa3a268d06d3c2
4
- data.tar.gz: 433cf3848255d0c1a77f25c360fd8987d1a99395
3
+ metadata.gz: f6885aa7657d2db7e9131719cd1a133dda8c5228
4
+ data.tar.gz: d1e8488742ffdb7a14dc5bc8c6781735767ee85f
5
5
  SHA512:
6
- metadata.gz: 0484b8bbfb2ef76fe911bc36995351d7445110fe487e5cae68a17b2225745bd0a05dd839e8e57617a29ac0d6f90a8a386be77bf93bedc2b5da966dfcb1f0ec62
7
- data.tar.gz: 6d61d61e6ce5797c6257e4a053c9284091815dcaab2f7304873cca62b8ddd81db495a9f25fc91e1d946a904514366ea6ee9b862e520f2d6885bfe2335bfee8cf
6
+ metadata.gz: 92161ba8353ba43e665489e568755f1c0152bbb3a243de383ddbd6efd114873588ac7fa3203a77a41ab9889b3f0b0fb1bace053187c18ccbcb98ebefca479f05
7
+ data.tar.gz: 576b83c544abbc8335edfc353571266e74cbf52fa9dba70e3ca31f49d183809ba1e1eb916e02386bbf6095525df3252dfa4804c385c7d7100e358b71036df954
@@ -25,13 +25,17 @@ module Qlang
25
25
  end
26
26
 
27
27
  def self.optimize_output(ruby_obj)
28
+
28
29
  case ruby_obj
29
30
  when Matrix, Vector, Dydx::Algebra::Formula
30
31
  ruby_obj.to_q
31
- when Float::INFINITY
32
- 'oo'
33
- when - Float::INFINITY
34
- '-oo'
32
+ when Numeric
33
+ # TODO: I know you wanna way..
34
+ if ruby_obj > 10000.0 then 'oo'
35
+ elsif ruby_obj < -10000.0 then '-oo'
36
+ elsif ruby_obj.abs < Float::EPSILON then '0.0'
37
+ else ruby_obj.to_s.equalize!
38
+ end
35
39
  else
36
40
  str = ruby_obj.to_s
37
41
  str.equalize!
@@ -1,3 +1,3 @@
1
1
  module Qlang
2
- VERSION = "0.0.27182121"
2
+ VERSION = "0.0.27182122"
3
3
  end
@@ -24,5 +24,15 @@ class TestLimit < TestInterpreterBase
24
24
  '2.7182682371744895',
25
25
  'lim[x->oo] (1 + 1/x)^x'
26
26
  )
27
+
28
+ assert_iq_equal(
29
+ 'oo',
30
+ 'lim[x->oo] x'
31
+ )
32
+
33
+ assert_iq_equal(
34
+ '0.0',
35
+ 'lim[x->0] x'
36
+ )
27
37
  end
28
38
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qlang
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.27182121
4
+ version: 0.0.27182122
5
5
  platform: ruby
6
6
  authors:
7
7
  - gogotanaka