bigdecimal 1.3.0.pre.2 → 1.3.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
  SHA1:
3
- metadata.gz: fdcd8a22af29f84d5b2298871bacf1eb0aa04817
4
- data.tar.gz: 7afdfb30fb4afb16c1df2cc628bf3d3b6b6e9999
3
+ metadata.gz: e26ceb2017642a4b5325636c315f5b541579f890
4
+ data.tar.gz: 58db7e3cc1e17b3754a3dac96425fffaf11cb648
5
5
  SHA512:
6
- metadata.gz: c071e3278a1a093dba535a87c5653a6f530db3629f0e4cff3328ef71c60f449741c1d2aafda6e0dbc5ad7152c242b349a3cc4106ee9e86383f62bd8ce6c38193
7
- data.tar.gz: fe1cd40130e713ed36ba6e54a458df0d231b1699f7264e2aeece544984c827ea115659246ddfa9a2fdf0c01b21bc1d38dea0678f3170f9fcc12b609416963f83
6
+ metadata.gz: c479456ed3a6ae4bb3de2a4cbbc02d0eaee8455fd2a9bfeaeaa4115474828197cfc321ea4ec96faf0476ed0efecf5a721705cbcea011c01bd911d433e067f4ff
7
+ data.tar.gz: 03b204ded5fe35cbf6355b59fc0a4b90314488ad0d9cf8c5b6287b177afe78cbf2d053ce968dd8a57f67ac0dd47cdb9d40f65dcd75d4083b15376169f2656bc6
data/bigdecimal.gemspec CHANGED
@@ -1,5 +1,5 @@
1
1
  # coding: utf-8
2
- _VERSION = '1.3.0.pre.2'
2
+ _VERSION = '1.3.0'
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "bigdecimal"
@@ -335,15 +335,18 @@ BigDecimal_double_fig(VALUE self)
335
335
  return INT2FIX(VpDblFig());
336
336
  }
337
337
 
338
- /* call-seq:
339
- * precs
338
+ /* call-seq:
339
+ * big_decimal.precs -> array
340
+ *
341
+ * Returns an Array of two Integer values.
340
342
  *
341
- * Returns an Array of two Integer values.
343
+ * The first value is the current number of significant digits in the
344
+ * BigDecimal. The second value is the maximum number of significant digits
345
+ * for the BigDecimal.
342
346
  *
343
- * The first value is the current number of significant digits in the
344
- * BigDecimal. The second value is the maximum number of significant digits
345
- * for the BigDecimal.
347
+ * BigDecimal('5').precs #=> [9, 18]
346
348
  */
349
+
347
350
  static VALUE
348
351
  BigDecimal_prec(VALUE self)
349
352
  {
@@ -456,7 +459,7 @@ check_rounding_mode_option(VALUE const opts)
456
459
  goto noopt;
457
460
 
458
461
  mode = rb_hash_lookup2(opts, ID2SYM(id_half), Qundef);
459
- if (mode == Qundef)
462
+ if (mode == Qundef || NIL_P(mode))
460
463
  goto noopt;
461
464
 
462
465
  if (SYMBOL_P(mode))
@@ -478,6 +481,7 @@ check_rounding_mode_option(VALUE const opts)
478
481
  return VP_ROUND_HALF_EVEN;
479
482
  else if (strncasecmp(s, "down", 4) == 0)
480
483
  return VP_ROUND_HALF_DOWN;
484
+ break;
481
485
  default:
482
486
  break;
483
487
  }
@@ -901,13 +905,14 @@ BigDecimal_coerce(VALUE self, VALUE other)
901
905
  }
902
906
 
903
907
  /*
904
- * call-seq: +@
908
+ * call-seq:
909
+ * +big_decimal -> big_decimal
905
910
  *
906
911
  * Return self.
907
912
  *
908
- * e.g.
909
- * b = +a # b == a
913
+ * +BigDecimal('5') #=> 0.5e1
910
914
  */
915
+
911
916
  static VALUE
912
917
  BigDecimal_uplus(VALUE self)
913
918
  {
@@ -1218,14 +1223,14 @@ BigDecimal_ge(VALUE self, VALUE r)
1218
1223
  }
1219
1224
 
1220
1225
  /*
1221
- * call-seq: -@
1226
+ * call-seq:
1227
+ * -big_decimal -> big_decimal
1222
1228
  *
1223
- * Return the negation of self.
1229
+ * Return the negation of self.
1224
1230
  *
1225
- * e.g.
1226
- * b = -a
1227
- * b == a * -1
1231
+ * -BigDecimal('5') #=> -0.5e1
1228
1232
  */
1233
+
1229
1234
  static VALUE
1230
1235
  BigDecimal_neg(VALUE self)
1231
1236
  {
@@ -1672,11 +1677,16 @@ BigDecimal_mult2(VALUE self, VALUE b, VALUE n)
1672
1677
  }
1673
1678
  }
1674
1679
 
1675
- /* Returns the absolute value, as a BigDecimal.
1680
+ /*
1681
+ * call-seq:
1682
+ * big_decimal.abs -> big_decimal
1676
1683
  *
1677
- * BigDecimal('5').abs #=> 5
1678
- * BigDecimal('-3').abs #=> 3
1684
+ * Returns the absolute value, as a BigDecimal.
1685
+ *
1686
+ * BigDecimal('5').abs #=> 0.5e1
1687
+ * BigDecimal('-3').abs #=> 0.3e1
1679
1688
  */
1689
+
1680
1690
  static VALUE
1681
1691
  BigDecimal_abs(VALUE self)
1682
1692
  {
@@ -26,7 +26,7 @@ require 'bigdecimal'
26
26
  # include BigMath
27
27
  #
28
28
  # a = BigDecimal((PI(100)/2).to_s)
29
- # puts sin(a,100) # => 0.10000000000000000000......E1
29
+ # puts sin(a,100) # => 0.99999999999999999999......e0
30
30
  #
31
31
  module BigMath
32
32
  module_function
@@ -38,7 +38,7 @@ module BigMath
38
38
  # precision, +numeric+.
39
39
  #
40
40
  # BigMath.sqrt(BigDecimal.new('2'), 16).to_s
41
- # #=> "0.1414213562373095048801688724E1"
41
+ # #=> "0.1414213562373095048801688724e1"
42
42
  #
43
43
  def sqrt(x, prec)
44
44
  x.sqrt(prec)
@@ -53,7 +53,7 @@ module BigMath
53
53
  # If +decimal+ is Infinity or NaN, returns NaN.
54
54
  #
55
55
  # BigMath.sin(BigMath.PI(5)/4, 5).to_s
56
- # #=> "0.70710678118654752440082036563292800375E0"
56
+ # #=> "0.70710678118654752440082036563292800375e0"
57
57
  #
58
58
  def sin(x, prec)
59
59
  raise ArgumentError, "Zero or negative precision for sin" if prec <= 0
@@ -97,7 +97,7 @@ module BigMath
97
97
  # If +decimal+ is Infinity or NaN, returns NaN.
98
98
  #
99
99
  # BigMath.cos(BigMath.PI(4), 16).to_s
100
- # #=> "-0.999999999999999999999999999999856613163740061349E0"
100
+ # #=> "-0.999999999999999999999999999999856613163740061349e0"
101
101
  #
102
102
  def cos(x, prec)
103
103
  raise ArgumentError, "Zero or negative precision for cos" if prec <= 0
@@ -141,7 +141,7 @@ module BigMath
141
141
  # If +decimal+ is NaN, returns NaN.
142
142
  #
143
143
  # BigMath.atan(BigDecimal.new('-1'), 16).to_s
144
- # #=> "-0.785398163397448309615660845819878471907514682065E0"
144
+ # #=> "-0.785398163397448309615660845819878471907514682065e0"
145
145
  #
146
146
  def atan(x, prec)
147
147
  raise ArgumentError, "Zero or negative precision for atan" if prec <= 0
@@ -178,7 +178,7 @@ module BigMath
178
178
  # +numeric+.
179
179
  #
180
180
  # BigMath.PI(10).to_s
181
- # #=> "0.3141592653589793238462643388813853786957412E1"
181
+ # #=> "0.3141592653589793238462643388813853786957412e1"
182
182
  #
183
183
  def PI(prec)
184
184
  raise ArgumentError, "Zero or negative precision for PI" if prec <= 0
@@ -223,7 +223,7 @@ module BigMath
223
223
  # digits of precision, +numeric+.
224
224
  #
225
225
  # BigMath.E(10).to_s
226
- # #=> "0.271828182845904523536028752390026306410273E1"
226
+ # #=> "0.271828182845904523536028752390026306410273e1"
227
227
  #
228
228
  def E(prec)
229
229
  raise ArgumentError, "Zero or negative precision for E" if prec <= 0
@@ -13,7 +13,7 @@ class Integer < Numeric
13
13
  # require 'bigdecimal/util'
14
14
  #
15
15
  # 42.to_d
16
- # # => #<BigDecimal:1008ef070,'0.42E2',9(36)>
16
+ # # => 0.42e2
17
17
  #
18
18
  def to_d
19
19
  BigDecimal(self)
@@ -34,7 +34,7 @@ class Float < Numeric
34
34
  # require 'bigdecimal/util'
35
35
  #
36
36
  # 0.5.to_d
37
- # # => #<BigDecimal:1dc69e0,'0.5E0',9(18)>
37
+ # # => 0.5e0
38
38
  #
39
39
  def to_d(precision=nil)
40
40
  BigDecimal(self, precision || Float::DIG)
@@ -55,7 +55,7 @@ class String
55
55
  # require 'bigdecimal/util'
56
56
  #
57
57
  # "0.5".to_d
58
- # # => #<BigDecimal:1dc69e0,'0.5E0',9(18)>
58
+ # # => 0.5e0
59
59
  #
60
60
  def to_d
61
61
  BigDecimal(self)
@@ -117,7 +117,7 @@ class Rational < Numeric
117
117
  # r = (22/7.0).to_r
118
118
  # # => (7077085128725065/2251799813685248)
119
119
  # r.to_d(3)
120
- # # => #<BigDecimal:1a44d08,'0.314E1',18(36)>
120
+ # # => 0.314e1
121
121
  def to_d(precision)
122
122
  if precision <= 0
123
123
  raise ArgumentError, "negative precision"
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.0.pre.2
4
+ version: 1.3.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: 2016-12-10 00:00:00.000000000 Z
13
+ date: 2016-12-21 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
@@ -91,9 +91,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
91
91
  version: '0'
92
92
  required_rubygems_version: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: 1.3.1
96
+ version: '0'
97
97
  requirements: []
98
98
  rubyforge_project:
99
99
  rubygems_version: 2.6.7