bigdecimal 3.1.0 → 3.1.1

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: b4b34756c16a03ae97ed51c027a91b25c0c7f810697ad9ada535c2e7f5dc0d18
4
- data.tar.gz: 596784925b504f441a8cc4c90851562188452db1c08020c45c1bf0698c036110
3
+ metadata.gz: 9ca183be10a5ec4ff2ecb2c13e25b5ae7768606813eb0aa14b72bcbf4addc819
4
+ data.tar.gz: 1de83bfe351a536294d4f68991a7028003bb13077736649172f18f535999d769
5
5
  SHA512:
6
- metadata.gz: 9fa23788d9acfffc6e97a09c603f24155d4406fbc630207381eba8a74dc51b33ae5a80f5a952e1d80ffcdfc05d1e0feea9d50303e09d8be89e5594a6c67d8028
7
- data.tar.gz: 649a7df1ecdd33222c4b76b2368a595cb2858670ad7e21b1ac7dbb9f39b60ed1d56f02c219e43cfa9abc9a7de5f8829f1acf50b389630ece6443aacb0103351f
6
+ metadata.gz: e7c452da2ccece706e3991c6f5476552eb17d7de056396b084e563d711c1f060c4716ecb4960c2b07a7aa321b5afdd8b5473323c57b1f5f51561a813163de0e7
7
+ data.tar.gz: 946a0327cdaf66dc01e92861629d0b5dda5daeaa8e4e5e4b1f8eb2f6873cad015f91ac352b9c28bdd88243835fcc5aa56e0e02ab8519872ece1590e1359012c8
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.0"
5
+ s.version = "3.1.1"
6
6
  s.authors = ["Kenta Murata", "Zachary Scott", "Shigeo Kobayashi"]
7
7
  s.email = ["mrkn@mrkn.jp"]
8
8
 
@@ -1618,7 +1618,8 @@ 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;
1621
+ Real *a, *b, *d;
1622
+ ssize_t a_prec, b_prec;
1622
1623
  size_t mx;
1623
1624
 
1624
1625
  TypedData_Get_Struct(self, Real, &BigDecimal_data_type, a);
@@ -1644,18 +1645,27 @@ BigDecimal_divide(VALUE self, VALUE r, Real **c, Real **res, Real **div)
1644
1645
 
1645
1646
  TypedData_Get_Struct(rr, Real, &BigDecimal_data_type, b);
1646
1647
  SAVE(b);
1647
-
1648
1648
  *div = b;
1649
+
1649
1650
  mx = (a->Prec > b->Prec) ? a->Prec : b->Prec;
1650
1651
  mx *= BASE_FIG;
1652
+
1653
+ BigDecimal_count_precision_and_scale(self, &a_prec, NULL);
1654
+ BigDecimal_count_precision_and_scale(rr, &b_prec, NULL);
1655
+ mx = (a_prec > b_prec) ? a_prec : b_prec;
1656
+
1651
1657
  if (2*BIGDECIMAL_DOUBLE_FIGURES > mx)
1652
1658
  mx = 2*BIGDECIMAL_DOUBLE_FIGURES;
1659
+
1653
1660
  GUARD_OBJ((*c), VpCreateRbObject(mx + 2*BASE_FIG, "#0", true));
1654
1661
  GUARD_OBJ((*res), VpCreateRbObject(mx*2 + 2*BASE_FIG, "#0", true));
1655
1662
  VpDivd(*c, *res, a, b);
1663
+
1656
1664
  return Qnil;
1657
1665
  }
1658
1666
 
1667
+ static VALUE BigDecimal_DoDivmod(VALUE self, VALUE r, Real **div, Real **mod);
1668
+
1659
1669
  /* call-seq:
1660
1670
  * a / b -> bigdecimal
1661
1671
  *
@@ -1736,6 +1746,7 @@ BigDecimal_DoDivmod(VALUE self, VALUE r, Real **div, Real **mod)
1736
1746
  ENTER(8);
1737
1747
  Real *c=NULL, *d=NULL, *res=NULL;
1738
1748
  Real *a, *b;
1749
+ ssize_t a_prec, b_prec;
1739
1750
  size_t mx;
1740
1751
 
1741
1752
  TypedData_Get_Struct(self, Real, &BigDecimal_data_type, a);
@@ -1793,8 +1804,10 @@ BigDecimal_DoDivmod(VALUE self, VALUE r, Real **div, Real **mod)
1793
1804
  return Qtrue;
1794
1805
  }
1795
1806
 
1796
- mx = (a->Prec > b->Prec) ? a->Prec : b->Prec;
1797
- mx *= BASE_FIG;
1807
+ BigDecimal_count_precision_and_scale(self, &a_prec, NULL);
1808
+ BigDecimal_count_precision_and_scale(rr, &b_prec, NULL);
1809
+
1810
+ mx = (a_prec > b_prec) ? a_prec : b_prec;
1798
1811
  if (2*BIGDECIMAL_DOUBLE_FIGURES > mx)
1799
1812
  mx = 2*BIGDECIMAL_DOUBLE_FIGURES;
1800
1813
 
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.0
4
+ version: 3.1.1
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-21 00:00:00.000000000 Z
13
+ date: 2021-12-23 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: This library provides arbitrary-precision decimal floating-point number
16
16
  class.