bigdecimal 1.4.1 → 2.0.0

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: ba59492c4c5d6d57a15b9a02b25d8587257d66a083a80eba82ad65d2209a77c5
4
- data.tar.gz: d25d0be615ff46b7f38a64ddedda4964c965ef9f9a20fc1a7a79acfa3a297151
3
+ metadata.gz: 4fe17cbc3e4c4013708f79a93c975f84b3b55c53028671ef217dde778438a909
4
+ data.tar.gz: 5ec9c5839c1ff24a1d08bca8087fff348ec5eaf5aeac910ebb4c972dc00b7b20
5
5
  SHA512:
6
- metadata.gz: 5e3de510a188c4658be5d4e6e163a81622aecd60d99d7ff605f18c180fff04fbb2bd327d18b2975e688fbc12c2ed9a02e25f3d94956872156f3b66c0256e4911
7
- data.tar.gz: c2db42684202a56b218164603222e6f511c53d9b91545c0a1b142e0570c421b0e16f6ec3d883267c92d6924fa1192fd73fea2eca0390afed5c5c1dcd7b986f21
6
+ metadata.gz: 653b43d52285c5b25dbef5a4ced242d289b966699e099ae37f122a120e924cabd484a534df3d62c1c2e03ae76fefdb874564631bcdd617f041b664b42c34d981
7
+ data.tar.gz: 0cc5144ca6df649f27338327021bc7644cd55f7834ff035e473b9abb68d821ea28f9a89f3e6210224547cce0be0c0a56bc9c72d89e63b8446407f2f3ef4ff602
data/bigdecimal.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  # coding: utf-8
2
2
 
3
- bigdecimal_version = '1.4.1'
3
+ bigdecimal_version = '2.0.0'
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
@@ -35,11 +30,10 @@ Gem::Specification.new do |s|
35
30
  sample/pi.rb
36
31
  ]
37
32
 
38
- s.required_ruby_version = Gem::Requirement.new(">= 2.3.0".freeze)
33
+ s.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
39
34
 
40
35
  s.add_development_dependency "rake", "~> 10.0"
41
36
  s.add_development_dependency "rake-compiler", ">= 0.9"
42
- s.add_development_dependency "rake-compiler-dock", ">= 0.6.1"
43
37
  s.add_development_dependency "minitest", "< 5.0.0"
44
38
  s.add_development_dependency "pry"
45
39
  end
@@ -127,6 +127,30 @@ rb_rational_den(VALUE rat)
127
127
  }
128
128
  #endif
129
129
 
130
+ #ifndef HAVE_RB_COMPLEX_REAL
131
+ static inline VALUE
132
+ rb_complex_real(VALUE cmp)
133
+ {
134
+ #ifdef HAVE_TYPE_STRUCT_RCOMPLEX
135
+ return RCOMPLEX(cmp)->real;
136
+ #else
137
+ return rb_funcall(cmp, rb_intern("real"), 0);
138
+ #endif
139
+ }
140
+ #endif
141
+
142
+ #ifndef HAVE_RB_COMPLEX_IMAG
143
+ static inline VALUE
144
+ rb_complex_imag(VALUE cmp)
145
+ {
146
+ #ifdef HAVE_TYPE_STRUCT_RCOMPLEX
147
+ return RCOMPLEX(cmp)->imag;
148
+ #else
149
+ return rb_funcall(cmp, rb_intern("imag"), 0);
150
+ #endif
151
+ }
152
+ #endif
153
+
130
154
  #define BIGDECIMAL_POSITIVE_P(bd) ((bd)->sign > 0)
131
155
  #define BIGDECIMAL_NEGATIVE_P(bd) ((bd)->sign < 0)
132
156
 
@@ -276,7 +300,6 @@ again:
276
300
  #ifdef ENABLE_NUMERIC_STRING
277
301
  case T_STRING:
278
302
  StringValueCStr(v);
279
- rb_check_safe_obj(v);
280
303
  return VpCreateRbObject(RSTRING_LEN(v) + VpBaseFig() + 1,
281
304
  RSTRING_PTR(v));
282
305
  #endif /* ENABLE_NUMERIC_STRING */
@@ -418,7 +441,6 @@ BigDecimal_load(VALUE self, VALUE str)
418
441
  unsigned long m=0;
419
442
 
420
443
  pch = (unsigned char *)StringValueCStr(str);
421
- rb_check_safe_obj(str);
422
444
  /* First get max prec */
423
445
  while((*pch) != (unsigned char)'\0' && (ch = *pch++) != (unsigned char)':') {
424
446
  if(!ISDIGIT(ch)) {
@@ -1756,12 +1778,15 @@ BigDecimal_fix(VALUE self)
1756
1778
  * round(n, mode)
1757
1779
  *
1758
1780
  * Round to the nearest integer (by default), returning the result as a
1759
- * BigDecimal.
1781
+ * BigDecimal if n is specified, or as an Integer if it isn't.
1760
1782
  *
1761
1783
  * BigDecimal('3.14159').round #=> 3
1762
1784
  * BigDecimal('8.7').round #=> 9
1763
1785
  * BigDecimal('-9.9').round #=> -10
1764
1786
  *
1787
+ * BigDecimal('3.14159').round(2).class.name #=> "BigDecimal"
1788
+ * BigDecimal('3.14159').round.class.name #=> "Integer"
1789
+ *
1765
1790
  * If n is specified and positive, the fractional part of the result has no
1766
1791
  * more than that many digits.
1767
1792
  *
@@ -2027,7 +2052,6 @@ BigDecimal_to_s(int argc, VALUE *argv, VALUE self)
2027
2052
  if (rb_scan_args(argc, argv, "01", &f) == 1) {
2028
2053
  if (RB_TYPE_P(f, T_STRING)) {
2029
2054
  psz = StringValueCStr(f);
2030
- rb_check_safe_obj(f);
2031
2055
  if (*psz == ' ') {
2032
2056
  fPlus = 1;
2033
2057
  psz++;
@@ -2560,6 +2584,10 @@ BigDecimal_clone(VALUE self)
2560
2584
  return self;
2561
2585
  }
2562
2586
 
2587
+ #ifdef HAVE_RB_OPTS_EXCEPTION_P
2588
+ int rb_opts_exception_p(VALUE opts, int default_value);
2589
+ #define opts_exception_p(opts) rb_opts_exception_p((opts), 1)
2590
+ #else
2563
2591
  static int
2564
2592
  opts_exception_p(VALUE opts)
2565
2593
  {
@@ -2568,12 +2596,20 @@ opts_exception_p(VALUE opts)
2568
2596
  if (!kwds[0]) {
2569
2597
  kwds[0] = rb_intern_const("exception");
2570
2598
  }
2571
- rb_get_kwargs(opts, kwds, 0, 1, &exception);
2599
+ if (!rb_get_kwargs(opts, kwds, 0, 1, &exception)) return 1;
2600
+ switch (exception) {
2601
+ case Qtrue: case Qfalse:
2602
+ break;
2603
+ default:
2604
+ rb_raise(rb_eArgError, "true or false is expected as exception: %+"PRIsVALUE,
2605
+ exception);
2606
+ }
2572
2607
  return exception != Qfalse;
2573
2608
  }
2609
+ #endif
2574
2610
 
2575
2611
  static Real *
2576
- BigDecimal_new(int argc, VALUE *argv)
2612
+ VpNewVarArg(int argc, VALUE *argv)
2577
2613
  {
2578
2614
  size_t mf;
2579
2615
  VALUE opts = Qnil;
@@ -2616,6 +2652,7 @@ BigDecimal_new(int argc, VALUE *argv)
2616
2652
  }
2617
2653
  }
2618
2654
 
2655
+ retry:
2619
2656
  switch (TYPE(iniValue)) {
2620
2657
  case T_DATA:
2621
2658
  if (is_kind_of_BigDecimal(iniValue)) {
@@ -2653,6 +2690,18 @@ BigDecimal_new(int argc, VALUE *argv)
2653
2690
  }
2654
2691
  return GetVpValueWithPrec(iniValue, mf, 1);
2655
2692
 
2693
+ case T_COMPLEX:
2694
+ {
2695
+ VALUE im;
2696
+ im = rb_complex_imag(iniValue);
2697
+ if (!is_zero(im)) {
2698
+ rb_raise(rb_eArgError,
2699
+ "Unable to make a BigDecimal from non-zero imaginary number");
2700
+ }
2701
+ iniValue = rb_complex_real(iniValue);
2702
+ goto retry;
2703
+ }
2704
+
2656
2705
  case T_STRING:
2657
2706
  /* fall through */
2658
2707
  default:
@@ -2710,8 +2759,11 @@ f_BigDecimal(int argc, VALUE *argv, VALUE self)
2710
2759
  Real *pv;
2711
2760
  VALUE obj;
2712
2761
 
2762
+ if (argc > 0 && CLASS_OF(argv[0]) == rb_cBigDecimal) {
2763
+ if (argc == 1 || (argc == 2 && RB_TYPE_P(argv[1], T_HASH))) return argv[0];
2764
+ }
2713
2765
  obj = TypedData_Wrap_Struct(rb_cBigDecimal, &BigDecimal_data_type, 0);
2714
- pv = BigDecimal_new(argc, argv);
2766
+ pv = VpNewVarArg(argc, argv);
2715
2767
  if (pv == NULL) return Qnil;
2716
2768
  SAVE(pv);
2717
2769
  if (ToValue(pv)) pv = VpCopy(NULL, pv);
@@ -2720,6 +2772,20 @@ f_BigDecimal(int argc, VALUE *argv, VALUE self)
2720
2772
  return pv->obj = obj;
2721
2773
  }
2722
2774
 
2775
+ static VALUE
2776
+ BigDecimal_s_interpret_loosely(VALUE klass, VALUE str)
2777
+ {
2778
+ ENTER(1);
2779
+ char const *c_str;
2780
+ Real *pv;
2781
+
2782
+ c_str = StringValueCStr(str);
2783
+ GUARD_OBJ(pv, VpAlloc(0, c_str, 0, 1));
2784
+ pv->obj = TypedData_Wrap_Struct(klass, &BigDecimal_data_type, pv);
2785
+ RB_OBJ_FREEZE(pv->obj);
2786
+ return pv->obj;
2787
+ }
2788
+
2723
2789
  /* call-seq:
2724
2790
  * BigDecimal.limit(digits)
2725
2791
  *
@@ -2939,6 +3005,10 @@ BigMath_s_exp(VALUE klass, VALUE x, VALUE vprec)
2939
3005
  n = prec + rmpd_double_figures();
2940
3006
  negative = BIGDECIMAL_NEGATIVE_P(vx);
2941
3007
  if (negative) {
3008
+ VALUE x_zero = INT2NUM(1);
3009
+ VALUE x_copy = f_BigDecimal(1, &x_zero, klass);
3010
+ x = BigDecimal_initialize_copy(x_copy, x);
3011
+ vx = DATA_PTR(x);
2942
3012
  VpSetSign(vx, 1);
2943
3013
  }
2944
3014
 
@@ -3140,20 +3210,6 @@ get_vp_value:
3140
3210
  return y;
3141
3211
  }
3142
3212
 
3143
- VALUE
3144
- rmpd_util_str_to_d(VALUE str)
3145
- {
3146
- ENTER(1);
3147
- char const *c_str;
3148
- Real *pv;
3149
-
3150
- c_str = StringValueCStr(str);
3151
- GUARD_OBJ(pv, VpAlloc(0, c_str, 0, 1));
3152
- pv->obj = TypedData_Wrap_Struct(rb_cBigDecimal, &BigDecimal_data_type, pv);
3153
- RB_OBJ_FREEZE(pv->obj);
3154
- return pv->obj;
3155
- }
3156
-
3157
3213
  /* Document-class: BigDecimal
3158
3214
  * BigDecimal provides arbitrary-precision floating point decimal arithmetic.
3159
3215
  *
@@ -3300,6 +3356,7 @@ Init_bigdecimal(void)
3300
3356
  /* Class methods */
3301
3357
  rb_undef_method(CLASS_OF(rb_cBigDecimal), "allocate");
3302
3358
  rb_undef_method(CLASS_OF(rb_cBigDecimal), "new");
3359
+ rb_define_singleton_method(rb_cBigDecimal, "interpret_loosely", BigDecimal_s_interpret_loosely, 1);
3303
3360
  rb_define_singleton_method(rb_cBigDecimal, "mode", BigDecimal_mode, -1);
3304
3361
  rb_define_singleton_method(rb_cBigDecimal, "limit", BigDecimal_limit, -1);
3305
3362
  rb_define_singleton_method(rb_cBigDecimal, "double_fig", BigDecimal_double_fig, 0);
@@ -3430,7 +3487,6 @@ Init_bigdecimal(void)
3430
3487
 
3431
3488
 
3432
3489
  /* instance methods */
3433
- rb_define_method(rb_cBigDecimal, "initialize_copy", BigDecimal_initialize_copy, 1);
3434
3490
  rb_define_method(rb_cBigDecimal, "precs", BigDecimal_prec, 0);
3435
3491
 
3436
3492
  rb_define_method(rb_cBigDecimal, "add", BigDecimal_add2, 2);
@@ -4281,7 +4337,7 @@ VpAlloc(size_t mx, const char *szVal, int strict_p, int exc)
4281
4337
 
4282
4338
  psz[i] = '\0';
4283
4339
 
4284
- if (((ni == 0 || dot_seen) && nf == 0) || (exp_seen && ne == 0)) {
4340
+ if (strict_p && (((ni == 0 || dot_seen) && nf == 0) || (exp_seen && ne == 0))) {
4285
4341
  VALUE str;
4286
4342
  invalid_value:
4287
4343
  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")
@@ -25,8 +36,12 @@ have_func("isfinite", "math.h")
25
36
  have_type("struct RRational", "ruby.h")
26
37
  have_func("rb_rational_num", "ruby.h")
27
38
  have_func("rb_rational_den", "ruby.h")
39
+ have_type("struct RComplex", "ruby.h")
40
+ have_func("rb_complex_real", "ruby.h")
41
+ have_func("rb_complex_imag", "ruby.h")
28
42
  have_func("rb_array_const_ptr", "ruby.h")
29
43
  have_func("rb_sym2str", "ruby.h")
44
+ have_func("rb_opts_exception_p", "ruby.h")
30
45
 
31
46
  if File.file?(File.expand_path('../lib/bigdecimal.rb', __FILE__))
32
47
  bigdecimal_rb = "$(srcdir)/lib/bigdecimal.rb"
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: false
2
- #
2
+
3
+ require 'bigdecimal'
4
+
3
5
  # require 'bigdecimal/jacobian'
4
6
  #
5
7
  # Provides methods to compute the Jacobian matrix of a set of equations at a
@@ -21,9 +23,6 @@
21
23
  #
22
24
  # fx is f.values(x).
23
25
  #
24
-
25
- require 'bigdecimal'
26
-
27
26
  module Jacobian
28
27
  module_function
29
28
 
@@ -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
 
@@ -129,6 +131,39 @@ class Rational < Numeric
129
131
  end
130
132
 
131
133
 
134
+ class Complex < Numeric
135
+ # call-seq:
136
+ # cmp.to_d -> bigdecimal
137
+ # cmp.to_d(precision) -> bigdecimal
138
+ #
139
+ # Returns the value as a BigDecimal.
140
+ #
141
+ # The +precision+ parameter is required for a rational complex number.
142
+ # This parameter is used to determine the number of significant digits
143
+ # for the result.
144
+ #
145
+ # require 'bigdecimal'
146
+ # require 'bigdecimal/util'
147
+ #
148
+ # Complex(0.1234567, 0).to_d(4) # => 0.1235e0
149
+ # Complex(Rational(22, 7), 0).to_d(3) # => 0.314e1
150
+ #
151
+ # See also BigDecimal::new.
152
+ #
153
+ def to_d(*args)
154
+ BigDecimal(self) unless self.imag.zero? # to raise eerror
155
+
156
+ if args.length == 0
157
+ case self.real
158
+ when Rational
159
+ BigDecimal(self.real) # to raise error
160
+ end
161
+ end
162
+ self.real.to_d(*args)
163
+ end
164
+ end
165
+
166
+
132
167
  class NilClass
133
168
  # call-seq:
134
169
  # nil.to_d -> bigdecimal
data/lib/bigdecimal.rb CHANGED
@@ -1,10 +1 @@
1
- begin
2
- require "#{RUBY_VERSION[/\d+\.\d+/]}/bigdecimal.so"
3
- rescue LoadError
4
- require 'bigdecimal.so'
5
- end
6
-
7
- def BigDecimal.new(*args, **kwargs)
8
- warn "BigDecimal.new is deprecated; use BigDecimal() method instead.", uplevel: 1
9
- BigDecimal(*args, **kwargs)
10
- end
1
+ require 'bigdecimal.so'
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.1
4
+ version: 2.0.0
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: 2018-12-25 00:00:00.000000000 Z
13
+ date: 2019-12-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
@@ -40,20 +40,6 @@ dependencies:
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
42
  version: '0.9'
43
- - !ruby/object:Gem::Dependency
44
- name: rake-compiler-dock
45
- requirement: !ruby/object:Gem::Requirement
46
- requirements:
47
- - - ">="
48
- - !ruby/object:Gem::Version
49
- version: 0.6.1
50
- type: :development
51
- prerelease: false
52
- version_requirements: !ruby/object:Gem::Requirement
53
- requirements:
54
- - - ">="
55
- - !ruby/object:Gem::Version
56
- version: 0.6.1
57
43
  - !ruby/object:Gem::Dependency
58
44
  name: minitest
59
45
  requirement: !ruby/object:Gem::Requirement
@@ -89,17 +75,12 @@ email:
89
75
  executables: []
90
76
  extensions:
91
77
  - ext/bigdecimal/extconf.rb
92
- - ext/bigdecimal/util/extconf.rb
93
78
  extra_rdoc_files: []
94
79
  files:
95
80
  - bigdecimal.gemspec
96
81
  - ext/bigdecimal/bigdecimal.c
97
- - ext/bigdecimal/bigdecimal.def
98
82
  - ext/bigdecimal/bigdecimal.h
99
- - ext/bigdecimal/depend
100
83
  - ext/bigdecimal/extconf.rb
101
- - ext/bigdecimal/util/extconf.rb
102
- - ext/bigdecimal/util/util.c
103
84
  - lib/bigdecimal.rb
104
85
  - lib/bigdecimal/jacobian.rb
105
86
  - lib/bigdecimal/ludcmp.rb
@@ -121,14 +102,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
121
102
  requirements:
122
103
  - - ">="
123
104
  - !ruby/object:Gem::Version
124
- version: 2.3.0
105
+ version: 2.4.0
125
106
  required_rubygems_version: !ruby/object:Gem::Requirement
126
107
  requirements:
127
108
  - - ">="
128
109
  - !ruby/object:Gem::Version
129
110
  version: '0'
130
111
  requirements: []
131
- rubygems_version: 3.0.1
112
+ rubygems_version: 3.0.3
132
113
  signing_key:
133
114
  specification_version: 4
134
115
  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 defined?($extlist)
8
- build_dir = "$(TARGET_SO_DIR)../"
9
- else
10
- base_dir = File.expand_path('../../../..', __FILE__)
11
- build_dir = File.join(base_dir, "tmp", RUBY_PLATFORM, "bigdecimal", RUBY_VERSION, "")
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
- }