bigdecimal 3.1.1 → 3.1.2

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
  SHA256:
3
- metadata.gz: 9ca183be10a5ec4ff2ecb2c13e25b5ae7768606813eb0aa14b72bcbf4addc819
4
- data.tar.gz: 1de83bfe351a536294d4f68991a7028003bb13077736649172f18f535999d769
3
+ metadata.gz: e9f1adb536b8ac302d4fbf06879d28687d3007aa2f0e3bf886af0ef4f8224c97
4
+ data.tar.gz: 5d4b4c5a4f7251d582ac518cafb381fefaebc20f10b6247a065d68365e4a025f
5
5
  SHA512:
6
- metadata.gz: e7c452da2ccece706e3991c6f5476552eb17d7de056396b084e563d711c1f060c4716ecb4960c2b07a7aa321b5afdd8b5473323c57b1f5f51561a813163de0e7
7
- data.tar.gz: 946a0327cdaf66dc01e92861629d0b5dda5daeaa8e4e5e4b1f8eb2f6873cad015f91ac352b9c28bdd88243835fcc5aa56e0e02ab8519872ece1590e1359012c8
6
+ metadata.gz: b675d99a66877492caa8da094dfab99e4af68c4f53db1a4b796d896a5e2623be476594c149fe8a5a1b7f9290aee1b8499eb06202ee64e9f487c7221ef603693f
7
+ data.tar.gz: 754b623ee17b5ba432c39a19250bf838531f81a2cce8ceb3f1fb2d8469da31a8f94ed2e02e4d2fad24e451c2ee25529e95519f00dc9db3c935535b7ff4eaf016
data/bigdecimal.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "bigdecimal"
5
- s.version = "3.1.1"
5
+ s.version = "3.1.2"
6
6
  s.authors = ["Kenta Murata", "Zachary Scott", "Shigeo Kobayashi"]
7
7
  s.email = ["mrkn@mrkn.jp"]
8
8
 
@@ -1618,7 +1618,7 @@ BigDecimal_divide(VALUE self, VALUE r, Real **c, Real **res, Real **div)
1618
1618
  /* For c = self.div(r): with round operation */
1619
1619
  {
1620
1620
  ENTER(5);
1621
- Real *a, *b, *d;
1621
+ Real *a, *b;
1622
1622
  ssize_t a_prec, b_prec;
1623
1623
  size_t mx;
1624
1624
 
@@ -1647,18 +1647,16 @@ BigDecimal_divide(VALUE self, VALUE r, Real **c, Real **res, Real **div)
1647
1647
  SAVE(b);
1648
1648
  *div = b;
1649
1649
 
1650
- mx = (a->Prec > b->Prec) ? a->Prec : b->Prec;
1651
- mx *= BASE_FIG;
1652
-
1653
1650
  BigDecimal_count_precision_and_scale(self, &a_prec, NULL);
1654
1651
  BigDecimal_count_precision_and_scale(rr, &b_prec, NULL);
1655
1652
  mx = (a_prec > b_prec) ? a_prec : b_prec;
1653
+ mx *= 2;
1656
1654
 
1657
1655
  if (2*BIGDECIMAL_DOUBLE_FIGURES > mx)
1658
1656
  mx = 2*BIGDECIMAL_DOUBLE_FIGURES;
1659
1657
 
1660
1658
  GUARD_OBJ((*c), VpCreateRbObject(mx + 2*BASE_FIG, "#0", true));
1661
- GUARD_OBJ((*res), VpCreateRbObject(mx*2 + 2*BASE_FIG, "#0", true));
1659
+ GUARD_OBJ((*res), VpCreateRbObject((mx + 1)*2 + 2*BASE_FIG, "#0", true));
1662
1660
  VpDivd(*c, *res, a, b);
1663
1661
 
1664
1662
  return Qnil;
@@ -1808,6 +1806,8 @@ BigDecimal_DoDivmod(VALUE self, VALUE r, Real **div, Real **mod)
1808
1806
  BigDecimal_count_precision_and_scale(rr, &b_prec, NULL);
1809
1807
 
1810
1808
  mx = (a_prec > b_prec) ? a_prec : b_prec;
1809
+ mx *= 2;
1810
+
1811
1811
  if (2*BIGDECIMAL_DOUBLE_FIGURES > mx)
1812
1812
  mx = 2*BIGDECIMAL_DOUBLE_FIGURES;
1813
1813
 
@@ -5931,18 +5931,17 @@ VpDivd(Real *c, Real *r, Real *a, Real *b)
5931
5931
  word_c = c->MaxPrec;
5932
5932
  word_r = r->MaxPrec;
5933
5933
 
5934
- ind_c = 0;
5935
- ind_r = 1;
5936
-
5937
5934
  if (word_a >= word_r) goto space_error;
5938
5935
 
5936
+ ind_r = 1;
5939
5937
  r->frac[0] = 0;
5940
5938
  while (ind_r <= word_a) {
5941
5939
  r->frac[ind_r] = a->frac[ind_r - 1];
5942
5940
  ++ind_r;
5943
5941
  }
5944
-
5945
5942
  while (ind_r < word_r) r->frac[ind_r++] = 0;
5943
+
5944
+ ind_c = 0;
5946
5945
  while (ind_c < word_c) c->frac[ind_c++] = 0;
5947
5946
 
5948
5947
  /* initial procedure */
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bigdecimal
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenta Murata
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-12-23 00:00:00.000000000 Z
13
+ date: 2022-01-19 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: This library provides arbitrary-precision decimal floating-point number
16
16
  class.