bigdecimal 3.1.8 → 3.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/bigdecimal/bigdecimal.c +5 -9
- data/ext/bigdecimal/extconf.rb +11 -9
- data/ext/bigdecimal/missing.c +2 -1
- data/lib/bigdecimal/util.rb +1 -1
- metadata +3 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61cbb7233c53f76dca23b078090706faa4c5796f983d9b0bf207bb2d6c652625
|
4
|
+
data.tar.gz: d7f68a343595d21e009f43ac47558d1805e004cefb85e6d0d423e46b307ba9fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b091bed99353940b359a3d4ba6639f67cfad6859efda3709007aec5310539c0159d333ee5fb425cdecde146d2bd4241b6e208ee273cde337f449d467a7593e4
|
7
|
+
data.tar.gz: 0fa14bd118018db4d4b436375f804d62e6c894458a3fa555cafc2c8da2888bd03dea8206e3ce15a73f82b35afcd6c8285881d2c76acb14e9013cf1e72f7284c3
|
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.1.
|
34
|
+
#define BIGDECIMAL_VERSION "3.1.9"
|
35
35
|
|
36
36
|
/* #define ENABLE_NUMERIC_STRING */
|
37
37
|
|
@@ -2459,7 +2459,7 @@ BigDecimal_fix(VALUE self)
|
|
2459
2459
|
* round(n, mode)
|
2460
2460
|
*
|
2461
2461
|
* Round to the nearest integer (by default), returning the result as a
|
2462
|
-
* BigDecimal if n is specified, or as an Integer if it isn't.
|
2462
|
+
* BigDecimal if n is specified and positive, or as an Integer if it isn't.
|
2463
2463
|
*
|
2464
2464
|
* BigDecimal('3.14159').round #=> 3
|
2465
2465
|
* BigDecimal('8.7').round #=> 9
|
@@ -2467,6 +2467,7 @@ BigDecimal_fix(VALUE self)
|
|
2467
2467
|
*
|
2468
2468
|
* BigDecimal('3.14159').round(2).class.name #=> "BigDecimal"
|
2469
2469
|
* BigDecimal('3.14159').round.class.name #=> "Integer"
|
2470
|
+
* BigDecimal('3.14159').round(0).class.name #=> "Integer"
|
2470
2471
|
*
|
2471
2472
|
* If n is specified and positive, the fractional part of the result has no
|
2472
2473
|
* more than that many digits.
|
@@ -5276,7 +5277,7 @@ VP_EXPORT Real *
|
|
5276
5277
|
VpAlloc(size_t mx, const char *szVal, int strict_p, int exc)
|
5277
5278
|
{
|
5278
5279
|
const char *orig_szVal = szVal;
|
5279
|
-
size_t i, j, ni, ipf, nf, ipe, ne,
|
5280
|
+
size_t i, j, ni, ipf, nf, ipe, ne, exp_seen, nalloc;
|
5280
5281
|
size_t len;
|
5281
5282
|
char v, *psz;
|
5282
5283
|
int sign=1;
|
@@ -5362,13 +5363,11 @@ VpAlloc(size_t mx, const char *szVal, int strict_p, int exc)
|
|
5362
5363
|
ne = 0; /* number of digits in the exponential part */
|
5363
5364
|
ipf = 0; /* index of the beginning of the fractional part */
|
5364
5365
|
ipe = 0; /* index of the beginning of the exponential part */
|
5365
|
-
dot_seen = 0;
|
5366
5366
|
exp_seen = 0;
|
5367
5367
|
|
5368
5368
|
if (v != '\0') {
|
5369
5369
|
/* Scanning fractional part */
|
5370
5370
|
if ((psz[i] = szVal[j]) == '.') {
|
5371
|
-
dot_seen = 1;
|
5372
5371
|
++i;
|
5373
5372
|
++j;
|
5374
5373
|
ipf = i;
|
@@ -5384,9 +5383,6 @@ VpAlloc(size_t mx, const char *szVal, int strict_p, int exc)
|
|
5384
5383
|
}
|
5385
5384
|
if (!strict_p) {
|
5386
5385
|
v = psz[i] = '\0';
|
5387
|
-
if (nf == 0) {
|
5388
|
-
dot_seen = 0;
|
5389
|
-
}
|
5390
5386
|
break;
|
5391
5387
|
}
|
5392
5388
|
goto invalid_value;
|
@@ -5457,7 +5453,7 @@ VpAlloc(size_t mx, const char *szVal, int strict_p, int exc)
|
|
5457
5453
|
|
5458
5454
|
psz[i] = '\0';
|
5459
5455
|
|
5460
|
-
if (strict_p && ((
|
5456
|
+
if (strict_p && ((ni == 0 && nf == 0) || (exp_seen && ne == 0))) {
|
5461
5457
|
VALUE str;
|
5462
5458
|
invalid_value:
|
5463
5459
|
if (!strict_p) {
|
data/ext/bigdecimal/extconf.rb
CHANGED
@@ -24,15 +24,17 @@ have_header("math.h")
|
|
24
24
|
have_header("stdbool.h")
|
25
25
|
have_header("stdlib.h")
|
26
26
|
|
27
|
-
have_header("x86intrin.h")
|
28
|
-
have_func("_lzcnt_u32", "x86intrin.h")
|
29
|
-
have_func("_lzcnt_u64", "x86intrin.h")
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
have_func("
|
34
|
-
have_func("
|
35
|
-
have_func("
|
27
|
+
if have_header("x86intrin.h")
|
28
|
+
have_func("_lzcnt_u32", "x86intrin.h")
|
29
|
+
have_func("_lzcnt_u64", "x86intrin.h")
|
30
|
+
end
|
31
|
+
|
32
|
+
if have_header("intrin.h")
|
33
|
+
have_func("__lzcnt", "intrin.h")
|
34
|
+
have_func("__lzcnt64", "intrin.h")
|
35
|
+
have_func("_BitScanReverse", "intrin.h")
|
36
|
+
have_func("_BitScanReverse64", "intrin.h")
|
37
|
+
end
|
36
38
|
|
37
39
|
have_func("labs", "stdlib.h")
|
38
40
|
have_func("llabs", "stdlib.h")
|
data/ext/bigdecimal/missing.c
CHANGED
data/lib/bigdecimal/util.rb
CHANGED
@@ -155,7 +155,7 @@ class Complex < Numeric
|
|
155
155
|
# See also Kernel.BigDecimal.
|
156
156
|
#
|
157
157
|
def to_d(*args)
|
158
|
-
BigDecimal(self) unless self.imag.zero? # to raise
|
158
|
+
BigDecimal(self) unless self.imag.zero? # to raise error
|
159
159
|
|
160
160
|
if args.length == 0
|
161
161
|
case self.real
|
metadata
CHANGED
@@ -1,16 +1,15 @@
|
|
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.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenta Murata
|
8
8
|
- Zachary Scott
|
9
9
|
- Shigeo Kobayashi
|
10
|
-
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date: 2024-
|
12
|
+
date: 2024-12-25 00:00:00.000000000 Z
|
14
13
|
dependencies: []
|
15
14
|
description: This library provides arbitrary-precision decimal floating-point number
|
16
15
|
class.
|
@@ -47,7 +46,6 @@ licenses:
|
|
47
46
|
- BSD-2-Clause
|
48
47
|
metadata:
|
49
48
|
changelog_uri: https://github.com/ruby/bigdecimal/blob/master/CHANGES.md
|
50
|
-
post_install_message:
|
51
49
|
rdoc_options: []
|
52
50
|
require_paths:
|
53
51
|
- lib
|
@@ -62,8 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
60
|
- !ruby/object:Gem::Version
|
63
61
|
version: '0'
|
64
62
|
requirements: []
|
65
|
-
rubygems_version: 3.
|
66
|
-
signing_key:
|
63
|
+
rubygems_version: 3.6.2
|
67
64
|
specification_version: 4
|
68
65
|
summary: Arbitrary-precision decimal floating-point number library.
|
69
66
|
test_files: []
|