zero or negative precision is error. fixes#5098.
[ruby-dev:44210]
* test/bigdecimal/test_bigdecimal_util.rb: add test for the above
change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
specifying precision. fixes#5098. [ruby-dev:44210]
* test/bigdecimal/test_bigdecimal_util.rb: add test for the above
change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
for symmetry to BigDecimal() function with an Integer.
fixes#5098. [ruby-dev:44210]
* test/bigdecimal/test_bigdecimal_util.rb: add test for the above
change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
for adapting other Numeric subclasses. [ruby-dev:44245]
* test/bigdecimal/test_bigdecimal_util.rb: test for the above change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
a BigDecimal.
* bigdecimal/bigdecimal.c (BigDecimal_new): support generating a new
BigDecimal from another BigDecimal using BigDecimal global function
or constructor. [ruby-dev:44245]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
precision treatment errors.
* test/bigdecimal/test_bigdecimal.rb: add tests for the above change.
fix precision treatment errors.
* ext/bigdecimal/bigdecimal.c (BigDecimal_power): precision argument
should be optional for its compatibility.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
for Float and Rational arguments.
* test/bigdecimal/test_bigdecimal.rb (test_new, test_cmp, test_power):
add and modify tests for the above change.
* ext/bigdecimal/bigdecimal.c (BigDecimalCmp): modify coding style to
match ruby's standard.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
a Float through Rational.
* ext/bigdecimal/bigdecimal.c (BigDecimal_new): ditto.
* test/bigdecimal/test_bigdecimal.rb (test_global_new_float): add a test for
the above changes.
* test/bigdecimal/test_bigdecimal.rb (test_new_with_float): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Rational. The precision used for instantiate a BigDecimal from the
given Rational is obtained from the receiver BigDecimal.
* test/bigdecimal/test_bigdecimal.rb (test_coerce): add a test for the
above change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
coercing from a Rational to stop requiring "bigecimal/util.rb".
[ruby-core:34318]
* ext/bigdecimal/bigdecimal.c (GetVpValue): refactoring.
* ext/bigdecimal/bigdecimal.c (BigDecimal_new): support instantiation from a
Rational.
* test/bigdecimal/test_bigdecimal.rb (test_global_new_with_rationao): add a
test for the above change.
* test/bigdecimal/test_bigdecimal.rb (test_new_with_rationao): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31864 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
BigDecimal object from an Integer.
* test/bigdecimal/test_bigdecimal.rb (test_new_with_integer):
add for testing the above change.
* ext/bigdecimal/bigdecimal.c (BigDecimal_global_new): replace its body
with a BigDecimal_new call.
* test/bigdecimal/test_bigdecimal.rb (test_global_new_with_integer):
add for testing the above change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
environment variables. based on a patch from funny-falcon at
https://gist.github.com/856296, but honors safe level.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
return the result of a block.
* test/bigdecimal/test_bigdecimal.rb (test_save_limit):
add a test for the above change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29363 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
return the result of a block.
* test/bigdecimal/test_bigdecimal.rb (test_save_rounding_mode):
add a test for the above change.
* test/bigdecimal/test_bigdecimal.rb (test_save_exception_mode):
add a test for the return value of BigDecimal.save_exception_mode.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29361 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
BigDecimal_sub2, BigDecimal_mult2, VpLimitRound): remove meaningless
casts to get rid of compiler warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29360 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
converting symbol to rounding mode number.
* ext/bigdecimal/bigdecimal.c (BigDecimal_mode, BigDecimal_round):
support to specify rounding mode by symbol.
* test/bigdecimal/test_bigdecimal.rb (test_mode, test_round):
add tests for avobe changes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29295 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
and half-even. This change is based on the patch created by Matthew
Willson, the reporter of this bug. [Bug #3803] [ruby-core:32136]
* test/bigdecimal/test_bigdecimal.rb: add tests for above changes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29293 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/bigdecimal/test_bigdecimal.rb (test_to_f): added test for the above changes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
use "long long".
* ext/bigdecimal.bigdecimal.c (BigDecimal_to_i): get rid of a warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e