bigdecimal 1.4.3 → 1.4.4

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: ab90fe1c4ebec626fd337c48854383ac98e78db9e0311ea6136f074bb87095c6
4
- data.tar.gz: d822b71864c562be4cae67e908cf019e8730b8f8bd410d1d3800d9ed70cc275f
3
+ metadata.gz: 87db143e2139576067ccfd911dde4e081aad19bc0faa08ca6b74a34c430e82de
4
+ data.tar.gz: 54bde88f847fae9e241ec3817e96f45d21a8831b5827f76a0b25915b576d0900
5
5
  SHA512:
6
- metadata.gz: 43d9fa4b95d10b11556e20c4e9986036e2bc089d886716c122fde110da1f611646f8fab4682177af166ccfb89dbf8b592d98d494b495ff38ec07625d6681d215
7
- data.tar.gz: 98560156f0e78664a9b94255f0e52be2c2439050be380fdbbc4b61d5fe8412fea75022b1adb720dbc4495072ff9ee0384bcef4ced4ceed7698e2359283b5324d
6
+ metadata.gz: 360aa77ae2daadf7ff173669e115b76038b17f233694b316b17a159bec27be4eb1c57adee88350e3e3bde27097257b6d3526e057a28f5a4e457864cceb3aec5a
7
+ data.tar.gz: 4cbb886e60336b3741f5f1cef0a29877384f1e51b49aee13a18d1afd4f4cea3b86a826cb1ee2923f23684a148334c9ec0a09bef620b29eb62283baa299b45366
@@ -1,6 +1,6 @@
1
1
  # coding: utf-8
2
2
 
3
- bigdecimal_version = '1.4.3'
3
+ bigdecimal_version = '1.4.4'
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "bigdecimal"
@@ -14,16 +14,11 @@ Gem::Specification.new do |s|
14
14
  s.license = "ruby"
15
15
 
16
16
  s.require_paths = %w[lib]
17
- s.extensions = %w[ext/bigdecimal/extconf.rb ext/bigdecimal/util/extconf.rb]
17
+ s.extensions = %w[ext/bigdecimal/extconf.rb]
18
18
  s.files = %w[
19
19
  bigdecimal.gemspec
20
20
  ext/bigdecimal/bigdecimal.c
21
- ext/bigdecimal/bigdecimal.def
22
21
  ext/bigdecimal/bigdecimal.h
23
- ext/bigdecimal/depend
24
- ext/bigdecimal/extconf.rb
25
- ext/bigdecimal/util/extconf.rb
26
- ext/bigdecimal/util/util.c
27
22
  lib/bigdecimal.rb
28
23
  lib/bigdecimal/jacobian.rb
29
24
  lib/bigdecimal/ludcmp.rb
@@ -2726,6 +2726,20 @@ f_BigDecimal(int argc, VALUE *argv, VALUE self)
2726
2726
  return BigDecimal_new(argc, argv, rb_cBigDecimal);
2727
2727
  }
2728
2728
 
2729
+ static VALUE
2730
+ BigDecimal_s_interpret_loosely(VALUE klass, VALUE str)
2731
+ {
2732
+ ENTER(1);
2733
+ char const *c_str;
2734
+ Real *pv;
2735
+
2736
+ c_str = StringValueCStr(str);
2737
+ GUARD_OBJ(pv, VpAlloc(0, c_str, 0, 1));
2738
+ pv->obj = TypedData_Wrap_Struct(klass, &BigDecimal_data_type, pv);
2739
+ RB_OBJ_FREEZE(pv->obj);
2740
+ return pv->obj;
2741
+ }
2742
+
2729
2743
  /* DEPRECATED: BigDecimal.new() */
2730
2744
  static VALUE
2731
2745
  BigDecimal_s_new(int argc, VALUE *argv, VALUE klass)
@@ -3153,20 +3167,6 @@ get_vp_value:
3153
3167
  return y;
3154
3168
  }
3155
3169
 
3156
- VALUE
3157
- rmpd_util_str_to_d(VALUE str)
3158
- {
3159
- ENTER(1);
3160
- char const *c_str;
3161
- Real *pv;
3162
-
3163
- c_str = StringValueCStr(str);
3164
- GUARD_OBJ(pv, VpAlloc(0, c_str, 0, 1));
3165
- pv->obj = TypedData_Wrap_Struct(rb_cBigDecimal, &BigDecimal_data_type, pv);
3166
- RB_OBJ_FREEZE(pv->obj);
3167
- return pv->obj;
3168
- }
3169
-
3170
3170
  /* Document-class: BigDecimal
3171
3171
  * BigDecimal provides arbitrary-precision floating point decimal arithmetic.
3172
3172
  *
@@ -3312,6 +3312,7 @@ Init_bigdecimal(void)
3312
3312
 
3313
3313
  /* Class methods */
3314
3314
  rb_undef_method(CLASS_OF(rb_cBigDecimal), "allocate");
3315
+ rb_define_singleton_method(rb_cBigDecimal, "interpret_loosely", BigDecimal_s_interpret_loosely, 1);
3315
3316
  rb_define_singleton_method(rb_cBigDecimal, "new", BigDecimal_s_new, -1);
3316
3317
  rb_define_singleton_method(rb_cBigDecimal, "mode", BigDecimal_mode, -1);
3317
3318
  rb_define_singleton_method(rb_cBigDecimal, "limit", BigDecimal_limit, -1);
@@ -4294,7 +4295,7 @@ VpAlloc(size_t mx, const char *szVal, int strict_p, int exc)
4294
4295
 
4295
4296
  psz[i] = '\0';
4296
4297
 
4297
- if (((ni == 0 || dot_seen) && nf == 0) || (exp_seen && ne == 0)) {
4298
+ if (strict_p && (((ni == 0 || dot_seen) && nf == 0) || (exp_seen && ne == 0))) {
4298
4299
  VALUE str;
4299
4300
  invalid_value:
4300
4301
  if (!strict_p) {
@@ -1,6 +1,21 @@
1
1
  # frozen_string_literal: false
2
2
  require 'mkmf'
3
3
 
4
+ def check_bigdecimal_version(gemspec_path)
5
+ message "checking RUBY_BIGDECIMAL_VERSION... "
6
+
7
+ bigdecimal_version =
8
+ IO.readlines(gemspec_path)
9
+ .grep(/\Abigdecimal_version\s+=\s+/)[0][/\'([^\']+)\'/, 1]
10
+
11
+ version_components = bigdecimal_version.split('.')
12
+ bigdecimal_version = version_components[0, 3].join('.')
13
+ bigdecimal_version << "-#{version_components[3]}" if version_components[3]
14
+ $defs << %Q[-DRUBY_BIGDECIMAL_VERSION=\\"#{bigdecimal_version}\\"]
15
+
16
+ message "#{bigdecimal_version}\n"
17
+ end
18
+
4
19
  gemspec_name = gemspec_path = nil
5
20
  unless ['', '../../'].any? {|dir|
6
21
  gemspec_name = "#{dir}bigdecimal.gemspec"
@@ -11,11 +26,7 @@ unless ['', '../../'].any? {|dir|
11
26
  abort
12
27
  end
13
28
 
14
- bigdecimal_version =
15
- IO.readlines(gemspec_path)
16
- .grep(/\Abigdecimal_version\s+=\s+/)[0][/\'([\d\.]+)\'/, 1]
17
-
18
- $defs << %Q[-DRUBY_BIGDECIMAL_VERSION=\\"#{bigdecimal_version}\\"]
29
+ check_bigdecimal_version(gemspec_path)
19
30
 
20
31
  have_func("labs", "stdlib.h")
21
32
  have_func("llabs", "stdlib.h")
@@ -6,7 +6,6 @@
6
6
  #++
7
7
 
8
8
  require 'bigdecimal'
9
- require 'bigdecimal/util.so'
10
9
 
11
10
  class Integer < Numeric
12
11
  # call-seq:
@@ -66,6 +65,9 @@ class String
66
65
  #
67
66
  # See also BigDecimal::new.
68
67
  #
68
+ def to_d
69
+ BigDecimal.interpret_loosely(self)
70
+ end
69
71
  end
70
72
 
71
73
 
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.4.3
4
+ version: 1.4.4
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: 2019-01-10 00:00:00.000000000 Z
13
+ date: 2019-05-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
@@ -89,17 +89,12 @@ email:
89
89
  executables: []
90
90
  extensions:
91
91
  - ext/bigdecimal/extconf.rb
92
- - ext/bigdecimal/util/extconf.rb
93
92
  extra_rdoc_files: []
94
93
  files:
95
94
  - bigdecimal.gemspec
96
95
  - ext/bigdecimal/bigdecimal.c
97
- - ext/bigdecimal/bigdecimal.def
98
96
  - ext/bigdecimal/bigdecimal.h
99
- - ext/bigdecimal/depend
100
97
  - ext/bigdecimal/extconf.rb
101
- - ext/bigdecimal/util/extconf.rb
102
- - ext/bigdecimal/util/util.c
103
98
  - lib/bigdecimal.rb
104
99
  - lib/bigdecimal/jacobian.rb
105
100
  - lib/bigdecimal/ludcmp.rb
@@ -128,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
123
  - !ruby/object:Gem::Version
129
124
  version: '0'
130
125
  requirements: []
131
- rubygems_version: 3.0.1
126
+ rubygems_version: 3.0.3
132
127
  signing_key:
133
128
  specification_version: 4
134
129
  summary: Arbitrary-precision decimal floating-point number library.
@@ -1,3 +0,0 @@
1
- EXPORTS
2
- rmpd_util_str_to_d
3
- Init_bigdecimal
@@ -1,16 +0,0 @@
1
- extconf.h: $(srcdir)/$(GEMSPEC)
2
- Makefile: $(BIGDECIMAL_RB)
3
-
4
- # AUTOGENERATED DEPENDENCIES START
5
- bigdecimal.o: $(RUBY_EXTCONF_H)
6
- bigdecimal.o: $(arch_hdrdir)/ruby/config.h
7
- bigdecimal.o: $(hdrdir)/ruby/defines.h
8
- bigdecimal.o: $(hdrdir)/ruby/intern.h
9
- bigdecimal.o: $(hdrdir)/ruby/missing.h
10
- bigdecimal.o: $(hdrdir)/ruby/ruby.h
11
- bigdecimal.o: $(hdrdir)/ruby/st.h
12
- bigdecimal.o: $(hdrdir)/ruby/subst.h
13
- bigdecimal.o: $(hdrdir)/ruby/util.h
14
- bigdecimal.o: bigdecimal.c
15
- bigdecimal.o: bigdecimal.h
16
- # AUTOGENERATED DEPENDENCIES END
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: false
2
- require 'mkmf'
3
-
4
- checking_for(checking_message("Windows")) do
5
- case RUBY_PLATFORM
6
- when /cygwin|mingw/
7
- if ARGV.include?('-rdevkit') # check `rake -rdevkit compile` case
8
- base_dir = File.expand_path('../../../..', __FILE__)
9
- build_dir = File.join(base_dir, "tmp", RUBY_PLATFORM, "bigdecimal", RUBY_VERSION, "")
10
- else
11
- build_dir = "$(TARGET_SO_DIR)../"
12
- end
13
- $libs << " #{build_dir}bigdecimal.so"
14
- true
15
- when /mswin/
16
- $DLDFLAGS << " -libpath:.."
17
- $libs << " bigdecimal-$(arch).lib"
18
- true
19
- else
20
- false
21
- end
22
- end
23
-
24
- create_makefile('bigdecimal/util')
@@ -1,9 +0,0 @@
1
- #include "ruby.h"
2
-
3
- RUBY_EXTERN VALUE rmpd_util_str_to_d(VALUE str);
4
-
5
- void
6
- Init_util(void)
7
- {
8
- rb_define_method(rb_cString, "to_d", rmpd_util_str_to_d, 0);
9
- }