flt 1.5.2 → 1.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: c18be258a5dc6896076ab223a87ccd74c6d434ca
4
- data.tar.gz: 15a5156ede421d3ff6c4643d2e7b45afee19b154
2
+ SHA256:
3
+ metadata.gz: ec3f00c70c9eb39227e1b5acf490afd57b9dcedfa3d4a1fe5b935debc6cafcd9
4
+ data.tar.gz: 94808cc1dfe07687d93ff0c98b247373223683cad4a603ee7bda1ba33534ed79
5
5
  SHA512:
6
- metadata.gz: 9fc44a8e1334f94a9f9d78893cccaf3783fa236eb162bc0745b54f97226bf1a2e8ed8391012453495adc4a1bd4a95e470a5769d6c4ee21c82e694b21177a03a4
7
- data.tar.gz: 8a14074a6d969fefc1eb9a3927eded29ec0d8e175df29197361ef9787966fcf0ec3ecb6e6c6a3cef448b788b2eba8e799b0cd0ea731b04a7df89c0bf24187318
6
+ metadata.gz: b6f9272c9d849c240ff3697730e2465f4fbcbda9ebed66d75c6d36e866a02b5963cd664c0c0583e439747685c34562ed2ab83038f305ed12aa7a708848ec37c7
7
+ data.tar.gz: 1f1c4783c08ea9c324495d341884aae192e79e657b51eb7ac69ce74ab55fabbd2646c892194463e60041d8273687e57552a43f652973346ade4319b403b41652
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.4
4
+ - 2.7
@@ -1,3 +1,8 @@
1
+ == 1.5.3 2020-04-07
2
+
3
+ * Bugfix
4
+ - BigDecimal compatibility with Ruby 2.7
5
+
1
6
  == 1.5.2 2018-04-10
2
7
 
3
8
  * Bugfix
data/README.md CHANGED
@@ -361,7 +361,7 @@ DecNum.context.define_conversion_from(BigDecimal) do |x, context|
361
361
  DecNum(x.to_s)
362
362
  end
363
363
  DecNum.context.define_conversion_to(BigDecimal) do |x|
364
- BigDecimal.new(x.to_s)
364
+ BigDecimal(x.to_s)
365
365
  end
366
366
  ```
367
367
 
@@ -369,7 +369,7 @@ Now we can mix `BigDecimals` and `Decimals` in expressions and convert from `Dec
369
369
  to `BigDecimal`:
370
370
 
371
371
  ```ruby
372
- puts BigDecimal.new('1.1') + DecNum('2.2') # -> 3.3
372
+ puts BigDecimal('1.1') + DecNum('2.2') # -> 3.3
373
373
  puts DecNum('1.1').convert_to(BigDecimal) # -> 0.11E1
374
374
  ```
375
375
 
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_development_dependency "bundler", "~> 1.6"
22
- spec.add_development_dependency "rake"
23
- spec.add_development_dependency "minitest", "~> 5.10"
21
+ spec.add_development_dependency "bundler", ">= 1.9"
22
+ spec.add_development_dependency "rake", ">= 12.3.3"
23
+ spec.add_development_dependency "minitest", ">= 5.10"
24
24
  end
@@ -23,7 +23,7 @@ class Flt::BigDecimalContext
23
23
  def Num(*args)
24
24
  args = *args if args.size==1 && args.first.is_a?(Array)
25
25
  if args.size > 1
26
- BigDecimal.new(Flt::DecNum(*args).to_s)
26
+ BigDecimal(Flt::DecNum(*args).to_s)
27
27
  else
28
28
  x = args.first
29
29
  case x
@@ -32,7 +32,7 @@ class Flt::BigDecimalContext
32
32
  when Rational
33
33
  BigDecimal(x.numerator.to_s)/BigDecimal(x.denominator.to_s)
34
34
  else
35
- BigDecimal.new(x.to_s)
35
+ BigDecimal(x.to_s)
36
36
  end
37
37
  end
38
38
  end
@@ -417,7 +417,7 @@ class Num < Numeric
417
417
  # * :ignored_flags : a Flags object with the exceptions to be ignored
418
418
  # * :emin, :emax : minimum and maximum adjusted exponents
419
419
  # * :elimit : the exponent limits can also be defined by a single value;
420
- # if positive it is taken as emax and emin=1-emax; otherwiae it is
420
+ # if positive it is taken as emax and emin=1-emax; otherwise it is
421
421
  # taken as emin and emax=1-emin. Such limits comply with IEEE 754-2008
422
422
  # * :capitals : (true or false) to use capitals in text representations
423
423
  # * :clamp : (true or false) enables clamping
@@ -401,7 +401,7 @@ module Flt
401
401
  exp
402
402
  end.send(mode)
403
403
  _sign, digits, _base, vexp = v.split
404
- BigDecimal.new("0.#{digits}E#{vexp+exp}")
404
+ BigDecimal("0.#{digits}E#{vexp+exp}")
405
405
  else
406
406
  # assert num_class==BigDecimal && @radix==2
407
407
  exp = xs.map do |x|
@@ -1,3 +1,3 @@
1
1
  module Flt
2
- VERSION = "1.5.2"
2
+ VERSION = "1.5.3"
3
3
  end
@@ -30,7 +30,7 @@ class TestComparisons < Minitest::Test
30
30
  assert !(DecNum('1.1') == DecNum('1.0'))
31
31
  #assert DecNum('1.1') == 1.1
32
32
  #assert DecNum('1.0') == 1.0
33
- #assert DecNum('1.0') == BigDecimal.new('1.000')
33
+ #assert DecNum('1.0') == BigDecimal('1.000')
34
34
  assert DecNum('1.0') == 1
35
35
  assert DecNum('0.1') == Rational(1)/Rational(10)
36
36
 
@@ -32,22 +32,22 @@ class TestDefineConversions < Minitest::Test
32
32
  DecNum.context.define_conversion_from(BigDecimal) do |x, context|
33
33
  DecNum(x.to_s) # or use x.split etc.
34
34
  end
35
- assert DecNum('0') == BigDecimal.new('0')
36
- assert_equal BigDecimal.new('0'), DecNum('0')
37
- assert_equal BigDecimal.new('1.2345'), DecNum('1.2345')
38
- assert_equal BigDecimal.new('-1.2345'), DecNum('-1.2345')
39
- assert_equal BigDecimal.new('1.2345'), DecNum('0.0012345000E3')
40
- assert_equal DecNum('7.1'), BigDecimal.new('7')+DecNum('0.1')
41
- assert_equal DecNum('7.1'), DecNum('7')+BigDecimal.new('0.1')
42
- assert_equal DecNum('1.1'), DecNum(BigDecimal.new('1.1'))
43
- assert DecNum(BigDecimal.new('1.1')).is_a?(DecNum)
35
+ assert DecNum('0') == BigDecimal('0')
36
+ assert_equal BigDecimal('0'), DecNum('0')
37
+ assert_equal BigDecimal('1.2345'), DecNum('1.2345')
38
+ assert_equal BigDecimal('-1.2345'), DecNum('-1.2345')
39
+ assert_equal BigDecimal('1.2345'), DecNum('0.0012345000E3')
40
+ assert_equal DecNum('7.1'), BigDecimal('7')+DecNum('0.1')
41
+ assert_equal DecNum('7.1'), DecNum('7')+BigDecimal('0.1')
42
+ assert_equal DecNum('1.1'), DecNum(BigDecimal('1.1'))
43
+ assert DecNum(BigDecimal('1.1')).is_a?(DecNum)
44
44
 
45
45
  DecNum.context.define_conversion_to(BigDecimal) do |x|
46
- BigDecimal.new(x.to_s) # TODO: use x.split and handle special values
46
+ BigDecimal(x.to_s) # TODO: use x.split and handle special values
47
47
  end
48
48
 
49
49
  ['0.1', '-0.1', '0.0', '1234567.1234567', '-1234567.1234567', '1.234E7', '1.234E-7'].each do |n|
50
- f = BigDecimal.new(n)
50
+ f = BigDecimal(n)
51
51
  d = DecNum(n)
52
52
  c = d.convert_to(BigDecimal)
53
53
  assert c.is_a?(BigDecimal)
@@ -55,17 +55,17 @@ class TestDefineConversions < Minitest::Test
55
55
  end
56
56
  end
57
57
 
58
- assert_raises(TypeError, RuntimeError) { DecNum('0') == BigDecimal.new('0') }
58
+ assert_raises(TypeError, RuntimeError) { DecNum('0') == BigDecimal('0') }
59
59
  unless Num < Numeric
60
60
  # BigDecimal#eql? is weird
61
- refute_equal BigDecimal.new('0'), DecNum('0')
62
- refute_equal BigDecimal.new('1.2345'), DecNum('1.2345')
63
- refute_equal BigDecimal.new('-1.2345'), DecNum('-1.2345')
64
- refute_equal BigDecimal.new('1.2345'), DecNum('0.0012345000E3')
65
- assert_raises(TypeError) { BigDecimal.new('7')+DecNum('0.1') }
61
+ refute_equal BigDecimal('0'), DecNum('0')
62
+ refute_equal BigDecimal('1.2345'), DecNum('1.2345')
63
+ refute_equal BigDecimal('-1.2345'), DecNum('-1.2345')
64
+ refute_equal BigDecimal('1.2345'), DecNum('0.0012345000E3')
65
+ assert_raises(TypeError) { BigDecimal('7')+DecNum('0.1') }
66
66
  end
67
- assert_raises(TypeError, RuntimeError) { DecNum('7')+BigDecimal.new('0.1') }
68
- assert_raises(TypeError, RuntimeError) { DecNum(BigDecimal.new('1.1')) }
67
+ assert_raises(TypeError, RuntimeError) { DecNum('7')+BigDecimal('0.1') }
68
+ assert_raises(TypeError, RuntimeError) { DecNum(BigDecimal('1.1')) }
69
69
 
70
70
  ['0.1', '-0.1', '0.0', '1234567.1234567', '-1234567.1234567', '1.234E7', '1.234E-7'].each do |n|
71
71
  assert_raises(TypeError, RuntimeError) { DecNum(n).convert_to(BigDecimal) }
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flt
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.2
4
+ version: 1.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Javier Goizueta
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-10 00:00:00.000000000 Z
11
+ date: 2020-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.6'
19
+ version: '1.9'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.6'
26
+ version: '1.9'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 12.3.3
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: 12.3.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '5.10'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '5.10'
55
55
  description: Decimal and binary arbitrary precision floating point numbers in pure
@@ -61,6 +61,7 @@ extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
63
  - ".gitignore"
64
+ - ".travis.yml"
64
65
  - Gemfile
65
66
  - History.txt
66
67
  - License.txt
@@ -143,8 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
144
  - !ruby/object:Gem::Version
144
145
  version: '0'
145
146
  requirements: []
146
- rubyforge_project:
147
- rubygems_version: 2.6.8
147
+ rubygems_version: 3.1.2
148
148
  signing_key:
149
149
  specification_version: 4
150
150
  summary: Floating Point Numbers