bigdecimal 3.2.1 → 3.2.2
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/ext/bigdecimal/bigdecimal.c +13 -9
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8737ecb678e63a8a9e0aefe2d0ea606a523915d08b66b69704967749e15e53bf
|
4
|
+
data.tar.gz: 0dec9bb1cf41f347efdc60b918bab5f14264e6fc082011870dbc62391fde1270
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ddacbb0df3b6976bc560fab41363de45e4776c6e56d884a2c00a71015b838ff83d2a26b87e4af63d3e60fff27f6e90638f7cd6b363c62d06c78ac4c8250d6d5a
|
7
|
+
data.tar.gz: bc4ee4ace918f04364f882b69acb9c60bca9abc2405f426bbaa5831af21a9508c02c73c1f7302a3f25d387b7518d42095bc7bcbb817151e84ca2b9b0ce6889b5
|
data/ext/bigdecimal/bigdecimal.c
CHANGED
@@ -31,7 +31,7 @@
|
|
31
31
|
#include "bits.h"
|
32
32
|
#include "static_assert.h"
|
33
33
|
|
34
|
-
#define BIGDECIMAL_VERSION "3.2.
|
34
|
+
#define BIGDECIMAL_VERSION "3.2.2"
|
35
35
|
|
36
36
|
/* #define ENABLE_NUMERIC_STRING */
|
37
37
|
|
@@ -513,15 +513,10 @@ BigDecimal_prec(VALUE self)
|
|
513
513
|
}
|
514
514
|
|
515
515
|
static void
|
516
|
-
|
516
|
+
VpCountPrecisionAndScale(Real *p, ssize_t *out_precision, ssize_t *out_scale)
|
517
517
|
{
|
518
|
-
ENTER(1);
|
519
|
-
|
520
518
|
if (out_precision == NULL && out_scale == NULL)
|
521
519
|
return;
|
522
|
-
|
523
|
-
Real *p;
|
524
|
-
GUARD_OBJ(p, GetVpValue(self, 1));
|
525
520
|
if (VpIsZero(p) || !VpIsDef(p)) {
|
526
521
|
zero:
|
527
522
|
if (out_precision) *out_precision = 0;
|
@@ -625,6 +620,15 @@ BigDecimal_count_precision_and_scale(VALUE self, ssize_t *out_precision, ssize_t
|
|
625
620
|
}
|
626
621
|
}
|
627
622
|
|
623
|
+
static void
|
624
|
+
BigDecimal_count_precision_and_scale(VALUE self, ssize_t *out_precision, ssize_t *out_scale)
|
625
|
+
{
|
626
|
+
ENTER(1);
|
627
|
+
Real *p;
|
628
|
+
GUARD_OBJ(p, GetVpValue(self, 1));
|
629
|
+
VpCountPrecisionAndScale(p, out_precision, out_scale);
|
630
|
+
}
|
631
|
+
|
628
632
|
/*
|
629
633
|
* call-seq:
|
630
634
|
* precision -> integer
|
@@ -2166,8 +2170,8 @@ BigDecimal_div2(VALUE self, VALUE b, VALUE n)
|
|
2166
2170
|
|
2167
2171
|
if (ix == 0) {
|
2168
2172
|
ssize_t a_prec, b_prec;
|
2169
|
-
|
2170
|
-
|
2173
|
+
VpCountPrecisionAndScale(av, &a_prec, NULL);
|
2174
|
+
VpCountPrecisionAndScale(bv, &b_prec, NULL);
|
2171
2175
|
ix = ((a_prec > b_prec) ? a_prec : b_prec) + BIGDECIMAL_DOUBLE_FIGURES;
|
2172
2176
|
if (2 * BIGDECIMAL_DOUBLE_FIGURES > ix)
|
2173
2177
|
ix = 2 * BIGDECIMAL_DOUBLE_FIGURES;
|