bigdecimal 1.3.0 → 1.3.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 +2 -7
- data/ext/bigdecimal/extconf.rb +0 -4
- data/lib/bigdecimal/util.rb +20 -11
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8124f63d9fe1ebd037238255c97c7d690fb5e0fd
|
4
|
+
data.tar.gz: 1ee22f5a1d8a3508e4b385adf1a0bf9ef19d3a35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e6fbd671a8405a389112d7301a6b42bc09ae47da641b9d420be0ab4d177ca699e6bd0b0dbccdf87e0dcf3484cfdd5eced34590252508c857db742fd615b6982
|
7
|
+
data.tar.gz: 725be9a7d1947d86a08555bf33546806b534666dd7aec3fe529817475247ecae1a50aeeb7dad4a3dc5e8fe1f06379d16ee99daac9d1108e8e9426194eca6a2be
|
data/bigdecimal.gemspec
CHANGED
data/ext/bigdecimal/bigdecimal.c
CHANGED
@@ -5919,18 +5919,13 @@ Exit:
|
|
5919
5919
|
return 1;
|
5920
5920
|
}
|
5921
5921
|
|
5922
|
-
/*
|
5923
|
-
*
|
5924
|
-
* nf: digit position for operation.
|
5925
|
-
*
|
5926
|
-
*/
|
5927
|
-
VP_EXPORT int
|
5928
|
-
VpMidRound(Real *y, unsigned short f, ssize_t nf)
|
5929
5922
|
/*
|
5930
5923
|
* Round relatively from the decimal point.
|
5931
5924
|
* f: rounding mode
|
5932
5925
|
* nf: digit location to round from the decimal point.
|
5933
5926
|
*/
|
5927
|
+
VP_EXPORT int
|
5928
|
+
VpMidRound(Real *y, unsigned short f, ssize_t nf)
|
5934
5929
|
{
|
5935
5930
|
/* fracf: any positive digit under rounding position? */
|
5936
5931
|
/* fracf_1further: any positive digits under one further than the rounding position? */
|
data/ext/bigdecimal/extconf.rb
CHANGED
@@ -14,10 +14,6 @@ have_func("rb_rational_den", "ruby.h")
|
|
14
14
|
have_func("rb_array_const_ptr", "ruby.h")
|
15
15
|
have_func("rb_sym2str", "ruby.h")
|
16
16
|
|
17
|
-
have_macro("FIX_CONST_VALUE_PTR", "ruby.h")
|
18
|
-
have_macro("RARRAY_CONST_PTR", "ruby.h")
|
19
|
-
have_macro("RARRAY_AREF", "ruby.h")
|
20
|
-
|
21
17
|
create_makefile('bigdecimal')
|
22
18
|
|
23
19
|
# Add additional dependencies
|
data/lib/bigdecimal/util.rb
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
|
-
# BigDecimal extends the native Integer class to provide the #to_d method.
|
3
2
|
#
|
4
|
-
#
|
3
|
+
# bigdecimal/util extends various native classes to provide the #to_d method,
|
4
|
+
# and provides BigDecimal#to_d and BigDecimal#to_digits.
|
5
|
+
|
6
|
+
|
7
|
+
# bigdecimal/util extends the native Integer class to provide the #to_d method.
|
8
|
+
#
|
9
|
+
# When you require 'bigdecimal/util' in your application, this method will
|
5
10
|
# be available on Integer objects.
|
6
11
|
class Integer < Numeric
|
7
12
|
# call-seq:
|
@@ -20,9 +25,9 @@ class Integer < Numeric
|
|
20
25
|
end
|
21
26
|
end
|
22
27
|
|
23
|
-
#
|
28
|
+
# bigdecimal/util extends the native Float class to provide the #to_d method.
|
24
29
|
#
|
25
|
-
# When you require
|
30
|
+
# When you require 'bigdecimal/util' in your application, this method will be
|
26
31
|
# available on Float objects.
|
27
32
|
class Float < Numeric
|
28
33
|
# call-seq:
|
@@ -41,9 +46,9 @@ class Float < Numeric
|
|
41
46
|
end
|
42
47
|
end
|
43
48
|
|
44
|
-
#
|
49
|
+
# bigdecimal/util extends the native String class to provide the #to_d method.
|
45
50
|
#
|
46
|
-
# When you require
|
51
|
+
# When you require 'bigdecimal/util' in your application, this method will be
|
47
52
|
# available on String objects.
|
48
53
|
class String
|
49
54
|
# call-seq:
|
@@ -58,14 +63,18 @@ class String
|
|
58
63
|
# # => 0.5e0
|
59
64
|
#
|
60
65
|
def to_d
|
61
|
-
|
66
|
+
begin
|
67
|
+
BigDecimal(self)
|
68
|
+
rescue ArgumentError
|
69
|
+
BigDecimal(0)
|
70
|
+
end
|
62
71
|
end
|
63
72
|
end
|
64
73
|
|
65
|
-
#
|
74
|
+
# bigdecimal/util extends the BigDecimal class to provide the #to_digits and
|
66
75
|
# #to_d methods.
|
67
76
|
#
|
68
|
-
# When you require
|
77
|
+
# When you require 'bigdecimal/util' in your application, these methods will be
|
69
78
|
# available on BigDecimal objects.
|
70
79
|
class BigDecimal < Numeric
|
71
80
|
# call-seq:
|
@@ -99,9 +108,9 @@ class BigDecimal < Numeric
|
|
99
108
|
end
|
100
109
|
end
|
101
110
|
|
102
|
-
#
|
111
|
+
# bigdecimal/util extends the native Rational class to provide the #to_d method.
|
103
112
|
#
|
104
|
-
# When you require
|
113
|
+
# When you require 'bigdecimal/util' in your application, this method will be
|
105
114
|
# available on Rational objects.
|
106
115
|
class Rational < Numeric
|
107
116
|
# call-seq:
|
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: 1.3.
|
4
|
+
version: 1.3.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:
|
13
|
+
date: 2017-02-10 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
96
|
version: '0'
|
97
97
|
requirements: []
|
98
98
|
rubyforge_project:
|
99
|
-
rubygems_version: 2.6.
|
99
|
+
rubygems_version: 2.6.8
|
100
100
|
signing_key:
|
101
101
|
specification_version: 4
|
102
102
|
summary: Arbitrary-precision decimal floating-point number library.
|