summaryrefslogtreecommitdiff
path: root/ext/bigdecimal
diff options
context:
space:
mode:
authormrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-02-10 13:23:58 (GMT)
committermrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-02-10 13:23:58 (GMT)
commit70f772c3efb1caeb3333ba95b778967c6810695e (patch)
tree9b8cb2d2b0ab7e594f7ae8b4e70642f02a147cca /ext/bigdecimal
parent5d906263abf242b8c9209a9253cdfa4be3eb25dd (diff)
bigdecimal: version 1.3.1
Import bigdecimal version 1.3.1. The full commit log is here: https://github.com/ruby/bigdecimal/compare/v1.3.0...v1.3.1 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57597 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/bigdecimal')
-rw-r--r--ext/bigdecimal/bigdecimal.c9
-rw-r--r--ext/bigdecimal/bigdecimal.gemspec2
-rw-r--r--ext/bigdecimal/extconf.rb4
-rw-r--r--ext/bigdecimal/lib/bigdecimal/util.rb31
4 files changed, 23 insertions, 23 deletions
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c
index 0d9d051..9632a66 100644
--- a/ext/bigdecimal/bigdecimal.c
+++ b/ext/bigdecimal/bigdecimal.c
@@ -5920,17 +5920,12 @@ Exit:
}
/*
- *
- * nf: digit position for operation.
- *
- */
-VP_EXPORT int
-VpMidRound(Real *y, unsigned short f, ssize_t nf)
-/*
* Round relatively from the decimal point.
* f: rounding mode
* nf: digit location to round from the decimal point.
*/
+VP_EXPORT int
+VpMidRound(Real *y, unsigned short f, ssize_t nf)
{
/* fracf: any positive digit under rounding position? */
/* fracf_1further: any positive digits under one further than the rounding position? */
diff --git a/ext/bigdecimal/bigdecimal.gemspec b/ext/bigdecimal/bigdecimal.gemspec
index 3767e9b..74c08ca 100644
--- a/ext/bigdecimal/bigdecimal.gemspec
+++ b/ext/bigdecimal/bigdecimal.gemspec
@@ -1,5 +1,5 @@
# coding: utf-8
-_VERSION = '1.3.0'
+_VERSION = '1.3.1'
Gem::Specification.new do |s|
s.name = "bigdecimal"
diff --git a/ext/bigdecimal/extconf.rb b/ext/bigdecimal/extconf.rb
index b4f3a7a..1611d23 100644
--- a/ext/bigdecimal/extconf.rb
+++ b/ext/bigdecimal/extconf.rb
@@ -14,10 +14,6 @@ have_func("rb_rational_den", "ruby.h")
have_func("rb_array_const_ptr", "ruby.h")
have_func("rb_sym2str", "ruby.h")
-have_macro("FIX_CONST_VALUE_PTR", "ruby.h")
-have_macro("RARRAY_CONST_PTR", "ruby.h")
-have_macro("RARRAY_AREF", "ruby.h")
-
create_makefile('bigdecimal')
# Add additional dependencies
diff --git a/ext/bigdecimal/lib/bigdecimal/util.rb b/ext/bigdecimal/lib/bigdecimal/util.rb
index 670a625..e6606df 100644
--- a/ext/bigdecimal/lib/bigdecimal/util.rb
+++ b/ext/bigdecimal/lib/bigdecimal/util.rb
@@ -1,7 +1,12 @@
# frozen_string_literal: false
-# BigDecimal extends the native Integer class to provide the #to_d method.
#
-# When you require the BigDecimal library in your application, this method will
+# bigdecimal/util extends various native classes to provide the #to_d method,
+# and provides BigDecimal#to_d and BigDecimal#to_digits.
+
+
+# bigdecimal/util extends the native Integer class to provide the #to_d method.
+#
+# When you require 'bigdecimal/util' in your application, this method will
# be available on Integer objects.
class Integer < Numeric
# call-seq:
@@ -20,9 +25,9 @@ class Integer < Numeric
end
end
-# BigDecimal extends the native Float class to provide the #to_d method.
+# bigdecimal/util extends the native Float class to provide the #to_d method.
#
-# When you require BigDecimal in your application, this method will be
+# When you require 'bigdecimal/util' in your application, this method will be
# available on Float objects.
class Float < Numeric
# call-seq:
@@ -41,9 +46,9 @@ class Float < Numeric
end
end
-# BigDecimal extends the native String class to provide the #to_d method.
+# bigdecimal/util extends the native String class to provide the #to_d method.
#
-# When you require BigDecimal in your application, this method will be
+# When you require 'bigdecimal/util' in your application, this method will be
# available on String objects.
class String
# call-seq:
@@ -58,14 +63,18 @@ class String
# # => 0.5e0
#
def to_d
- BigDecimal(self)
+ begin
+ BigDecimal(self)
+ rescue ArgumentError
+ BigDecimal(0)
+ end
end
end
-# BigDecimal extends the native Numeric class to provide the #to_digits and
+# bigdecimal/util extends the BigDecimal class to provide the #to_digits and
# #to_d methods.
#
-# When you require BigDecimal in your application, this method will be
+# When you require 'bigdecimal/util' in your application, these methods will be
# available on BigDecimal objects.
class BigDecimal < Numeric
# call-seq:
@@ -99,9 +108,9 @@ class BigDecimal < Numeric
end
end
-# BigDecimal extends the native Rational class to provide the #to_d method.
+# bigdecimal/util extends the native Rational class to provide the #to_d method.
#
-# When you require BigDecimal in your application, this method will be
+# When you require 'bigdecimal/util' in your application, this method will be
# available on Rational objects.
class Rational < Numeric
# call-seq: