bigdecimal 1.2.4 → 1.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bigdecimal.c +19 -5
  3. data/bigdecimal.gemspec +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4c41d73d519030d6a97115486ade3119700dc79e
4
- data.tar.gz: c4a3ca819835bb6db328a3d855afdd0a31860479
3
+ metadata.gz: 3d7c070b55ea42a8186edff5bd590ec595c3f91b
4
+ data.tar.gz: 2b387b97b4360f632e8f71d17ad69b0e3ce0d582
5
5
  SHA512:
6
- metadata.gz: 46e465effb34908c3954dd120bca6693ae3dde3d666c7419e0a2d6729b111f1cbe120f4c1f97dec26e4085166cd578a72207191410b420a5f044d76ffb638277
7
- data.tar.gz: eca4ce9b2faf70b4c6c7f12a51f8e6bc5e2d37a5a5c170a2a0e6a32f15e893e1f2814583cfc586e7daca28161eeeab6a44a80ff835085a15614a8d71e33b2541
6
+ metadata.gz: f1bd4f4b4301d592507985496a19121906d4aeb9db7e3b862595e71ef1c87d6f3ac1d69227b8a1a582ec091cd6afb51f7f54e48db53bba2447623de62cd21500
7
+ data.tar.gz: 602f15737c778167bd453b408c6fe18c411461943f73ed819de569deb8c271676a97d356aecb8d95986660cc4b917933a694ddeec1ad7c3c78ec411006adadd7
@@ -99,6 +99,20 @@ static ID id_eq;
99
99
  # define RRATIONAL_NEGATIVE_P(x) RTEST(rb_funcall((x), '<', 1, INT2FIX(0)))
100
100
  #endif
101
101
 
102
+ #ifndef DECIMAL_SIZE_OF_BITS
103
+ #define DECIMAL_SIZE_OF_BITS(n) (((n) * 3010 + 9998) / 9999)
104
+ /* an approximation of ceil(n * log10(2)), upto 65536 at least */
105
+ #endif
106
+
107
+ #ifdef PRIsVALUE
108
+ # define RB_OBJ_CLASSNAME(obj) rb_obj_class(obj)
109
+ # define RB_OBJ_STRING(obj) (obj)
110
+ #else
111
+ # define PRIsVALUE "s"
112
+ # define RB_OBJ_CLASSNAME(obj) rb_obj_classname(obj)
113
+ # define RB_OBJ_STRING(obj) StringValueCStr(obj)
114
+ #endif
115
+
102
116
  /*
103
117
  * ================== Ruby Interface part ==========================
104
118
  */
@@ -274,8 +288,8 @@ SomeOneMayDoIt:
274
288
  unable_to_coerce_without_prec:
275
289
  if (must) {
276
290
  rb_raise(rb_eArgError,
277
- "%s can't be coerced into BigDecimal without a precision",
278
- rb_obj_classname(v));
291
+ "%"PRIsVALUE" can't be coerced into BigDecimal without a precision",
292
+ RB_OBJ_CLASSNAME(v));
279
293
  }
280
294
  return NULL;
281
295
  }
@@ -2261,8 +2275,8 @@ BigDecimal_power(int argc, VALUE*argv, VALUE self)
2261
2275
  /* fall through */
2262
2276
  default:
2263
2277
  rb_raise(rb_eTypeError,
2264
- "wrong argument type %s (expected scalar Numeric)",
2265
- rb_obj_classname(vexp));
2278
+ "wrong argument type %"PRIsVALUE" (expected scalar Numeric)",
2279
+ RB_OBJ_CLASSNAME(vexp));
2266
2280
  }
2267
2281
 
2268
2282
  if (VpIsZero(x)) {
@@ -2521,7 +2535,7 @@ BigDecimal_new(int argc, VALUE *argv)
2521
2535
  if (NIL_P(nFig)) {
2522
2536
  rb_raise(rb_eArgError,
2523
2537
  "can't omit precision for a %"PRIsVALUE".",
2524
- rb_obj_class(iniValue));
2538
+ RB_OBJ_CLASSNAME(iniValue));
2525
2539
  }
2526
2540
  return GetVpValueWithPrec(iniValue, mf, 1);
2527
2541
 
@@ -1,5 +1,5 @@
1
1
  # -*- ruby -*-
2
- _VERSION = "1.2.4"
2
+ _VERSION = "1.2.5"
3
3
  date = %w$Date:: $[1]
4
4
 
5
5
  Gem::Specification.new do |s|
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.2.4
4
+ version: 1.2.5
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: 2014-01-13 00:00:00.000000000 Z
13
+ date: 2014-01-15 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: This library provides arbitrary-precision decimal floating-point number
16
16
  class.