bigdecimal 3.1.0 → 3.1.1
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 +4 -4
- data/bigdecimal.gemspec +1 -1
- data/ext/bigdecimal/bigdecimal.c +17 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ca183be10a5ec4ff2ecb2c13e25b5ae7768606813eb0aa14b72bcbf4addc819
|
4
|
+
data.tar.gz: 1de83bfe351a536294d4f68991a7028003bb13077736649172f18f535999d769
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7c452da2ccece706e3991c6f5476552eb17d7de056396b084e563d711c1f060c4716ecb4960c2b07a7aa321b5afdd8b5473323c57b1f5f51561a813163de0e7
|
7
|
+
data.tar.gz: 946a0327cdaf66dc01e92861629d0b5dda5daeaa8e4e5e4b1f8eb2f6873cad015f91ac352b9c28bdd88243835fcc5aa56e0e02ab8519872ece1590e1359012c8
|
data/bigdecimal.gemspec
CHANGED
data/ext/bigdecimal/bigdecimal.c
CHANGED
@@ -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
|
-
|
1797
|
-
|
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.
|
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-
|
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.
|