Граф коммитов

218 Коммитов

Автор SHA1 Сообщение Дата
nobu e6ce15c68a * ext/bigdecimal/bigdecimal.gemspec (files): fixed typo, and
removed nonexistent file.
* ext/bigdecimal/bigdecimal.gemspec (homepage): added.
* ext/io/console/io-console.gemspec (homepage): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33470 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-16 10:46:30 +00:00
ayumin 839b4b5125 Fix typo
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-28 10:17:26 +00:00
ayumin fcb2bb8bd6 * ext/bigdecimal/README: update report to.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-27 19:15:51 +00:00
mrkn 0e18153140 * ext/bigdecimal/bigdecimal_en.html: removed because this file isn't
maintained now.
* ext/bigdecimal/bigdecimal_ja.html: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33348 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-27 19:06:52 +00:00
ayumin 0abbe4c1e6 * ext/bigdecimal/bigdecimal.c (BigDecimal_abs): Fix comment.
BigDecimal#sqrt requires argument. Reported by Makoto Kishimoto.
  Thanks for your contribution. [Bug #5267] [ruby-dev:44452]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-09 13:06:51 +00:00
mrkn 52c7bbd444 * ext/bigdecimal/bigdecimal.c (cannot_be_coerced_into_BigDecimal):
remove duplication.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-17 14:04:22 +00:00
mrkn 4e8d6c105c Merge branch '5172_bigdecimal_gc_issue' into trunk
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-17 06:35:21 +00:00
mrkn 5edd7f07d8 * ext/bigdecimal/bigdecimal.c (BigDecimal_version): version 1.1.0.
* ext/bigdecimal/bigdecimal.gemspec: turn into a default gem.
* tool/rbinstall.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-30 05:31:45 +00:00
nobu 72276eb06b * remove unused variables.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-29 15:49:36 +00:00
mrkn dca0b41777 * ext/bigdecimal/lib/bigdecimal/util.rb (Rational#to_d):
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
2011-07-26 15:49:47 +00:00
mrkn 079fb8d4c3 * ext/bigdecimal/lib/bigdecimal/util.rb (Float#to_d): modified for
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
2011-07-26 15:48:25 +00:00
mrkn 2fcb91c74c * ext/bigdecimal/lib/bigdecimal/util.rb (Integer#to_d): added
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
2011-07-26 15:46:42 +00:00
mrkn 5ba05758fe * ext/bigdecimal/lib/bigdecimal/util.rb (BigDecimal#to_d): added
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
2011-07-26 15:40:27 +00:00
mrkn a238140726 * bigdecimal/bigdecimal.c (VpDup) a new function for duplicating
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
2011-07-26 15:40:23 +00:00
mrkn 99f8f14d89 * ext/bigdecimal/bigdecimal.c (rmpd_power_by_big_decimal): fix
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
2011-07-10 14:05:07 +00:00
mrkn ebd61e5f28 * ext/bigdecimal/bigdecimal.c (BigDecimal_power): support non-integral
exponent.  fixes #3271
* ext/bigdecimal/bigdecimal.c (rmpd_power_by_big_decimal): ditto.
* ext/bigdecimal/bigdecimal.c (BigDecimal_power_op): add a function to
  only use for "**" operator.
* test/bigdecimal/test_bigdecimal.rb: add a bunch of tests for the
  above changes.
* ext/bigdecimal/bigdecimal.c (is_integer): add an utility function.
* ext/bigdecimal/bigdecimal.c (is_negative): ditto.
* ext/bigdecimal/bigdecimal.c (is_positive): ditto.
* ext/bigdecimal/bigdecimal.c (is_zero): ditto.
* ext/bigdecimal/bigdecimal.c (is_one): ditto.
* ext/bigdecimal/bigdecimal.c (is_even): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-10 03:19:49 +00:00
mrkn bb6384761e * ext/bigdecimal/bigdecimal.c (BigMath_s_log): move BigMath.log from
bigdecimal/math.rb.
* ext/bigdecimal/lib/bigdecimal/math.rb: ditto.
* test/bigdecimal/test_bigdecimal.rb: move test for BigMath.log from
  test/bigdecimal/test_bigmath.rb.
* test/bigdecimal/test_bigmath.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32258 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-27 16:26:09 +00:00
mrkn b7a693da8e * ext/bigdecimal/bigdecimal.c (VpNewRbClass): fix type of the 2nd
argument.
* ext/bigdecimal/bigdecimal.h: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-17 17:38:18 +00:00
mrkn f107d1e706 * ext/bigdecimal/bigdecimal.c (BigMath_s_exp): move BigMath.exp from
bigdecimal/math.rb.
* ext/bigdecimal/lib/bigdecimal/math.rb: ditto.
* test/bigdecimal/test_bigdecimal.rb: move test for BigMath.exp from
  test/bigdecimal/test_bigmath.rb.
* test/bigdecimal/test_bigmath.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-17 17:38:14 +00:00
mrkn 5112c6d1d9 * ext/bigdecimal/bigdecimal.c (is_kind_of_BigDecimal): new function to
examine the whether the object is kind of BigDecimal.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-13 09:51:52 +00:00
mrkn 3bd8b390de * ext/bigdecimal/bigdecimal.c (BigDecimalCmp): use GetVpValueWithPrec
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
2011-06-13 09:51:48 +00:00
tadf c2f9e1b100 * ext/bigdecimal (BigDecimal_to_i): Integer#** may return flonum.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-09 16:08:38 +00:00
nagachika 10c0604a34 * ext/bigdecimal/bigdecimal.c (GetVpValueWithPrec): remove unused
variable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-31 15:36:55 +00:00
mrkn 678b6820f7 * ext/bigdecimal/bigdecimal.c (GetVpValueWithPrec): support instantiation from
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
2011-05-31 15:33:42 +00:00
mrkn d7058e10dc * ext/bigdecimal/bigdecimal.c (BigDecimal_coerce): support coerce with a
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
2011-05-31 15:09:38 +00:00
mrkn 100931ac2c * ext/bigdecimal/bigdecimal.c (GetVpValueWithPrec): replace the algorithm for
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
2011-05-31 14:43:39 +00:00
mrkn b54141bb1b * ext/bigdecimal/bigdecimal.c (BigDecimal_new): support instantiation a
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
2011-05-31 13:45:31 +00:00
nobu 0d6d23b25d * ext: remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31689 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-22 09:26:02 +00:00
drbrain 5bae5b4ae2 * ext/bigdecimal/lib/bigdecimal/util.rb: Improve documentation. Patch
by Pete Higgins.  [Ruby 1.9 - Bug #4746]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-20 17:51:16 +00:00
drbrain 18d29d79a2 * ext/bigdecimal/lib/bigdecimal/jacobian.rb: Document isEqual. Patch
by Kuba Fietkiewicz.  [Ruby 1.9 - Bug #4744]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-20 17:44:27 +00:00
nobu 3a47cf3395 * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-15 11:55:52 +00:00
matz 1df42597d1 cancel subversion backfire. sorry
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-07 08:44:45 +00:00
matz eb807d42ec * gc.c (rb_gc_set_params): allow GC parameter configuration by
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
2011-03-07 08:39:39 +00:00
mrkn f83651ac30 * ext/bigdecimal/bigdecimal.c (VpMemAlloc): CVE-2011-0188.
Fixes a bug reported by Drew Yao <ayao at apple.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30993 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-01 04:40:49 +00:00
kazu 5e14eeb482 ext/bigdecimal/bigdecimal.h: suppress "warning: 'VPrint' declared 'static' but never defined".
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-11 08:46:28 +00:00
mrkn 0ec61a3156 * ext/bigdecimal/lib/bigdecimal/util.rb (to_digits): avoid unused
variables warning, reported by Aaron Patterson.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29805 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-16 00:37:31 +00:00
mrkn 3e85e58411 * ext/bigdecimal/bigdecimal.c (BIGDECIMAL_ENABLE_VPRINT):
VPrint is usually disabled.  It's only used in debugging.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29364 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-29 08:55:17 +00:00
mrkn ecfc868bdb * ext/bigdecimal/bigdecimal.c (BigDecimal_save_limit):
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
2010-09-29 08:55:11 +00:00
mrkn fed832d7f2 * ext/bigdecimal/bigdecimal.c (BigDecimal_save_rounding_mode):
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
2010-09-29 04:32:20 +00:00
usa 98d7c2b8f1 * ext/bigdecimal/bigdecimal.c (BigDecimal_div2, BigDecimal_add2,
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
2010-09-29 03:48:21 +00:00
nobu f20f30fc07 * ext/bigdecimal/bigdecimal.c (VPrint, VpToString): fix format.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-29 03:35:31 +00:00
mrkn 971a57004e * ext/bigdecimal/bigdecimal.c (check_rounding_mode, BigDecimal_mode):
raise ArgumentError instead of TypeError passing invalid modes.
* test/bigdecimal/test_bigdecimal.rb (test_mode, test_round):
  change against the above modifications.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-19 17:38:18 +00:00
mrkn fb7fe14575 * ext/bigdecimal/bigdecimal.c (check_rounding_mode): added for
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
2010-09-18 21:06:08 +00:00
mrkn 3cbda570c2 * ext/bigdecimal/bigdecimal.c: fix rounding algorithms for half-down
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
2010-09-18 20:19:38 +00:00
mrkn a2bf9203e8 * ext/bigdecimal/bigdecimal.c (BigDecimal_save_exception_mode,
BigDecimal_save_rounding_mode, BigDecimal_save_limit): added.
* test/bigdecimal/test_bigdecimal.rb: added tests for the above
  features.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29127 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-28 08:52:14 +00:00
mrkn 3dc6edf793 * ext/bigdecimal/bigdecimal.c (Init_bigdecimal, rmpd_set_thread_local_exception_mode, VpGetException, VpSetException): thread-local exception mode.
* ext/bigdecimal/bigdecimal.c (Init_bigdecimal, rmpd_set_thread_local_precision_limit, VpGetPrecLimit, VpSetPrecLimit): thread-local precision limit.
* ext/bigdecimal/bigdecimal.c (Init_bigdecimal, rmpd_set_thread_local_rounding_mode, VpGetRoundMode, VpSetRoundMode, VpException, VpInternalRound): thread-local rounding mode.
* ext/bigdecimal/bigdecimal.c (BigDecimal_mode, BigDecimal_round, VpIsRoundMode, VpGetRoundMode, VpSetRoundMode, VpActiveRound, VpMidRound, VpLeftRound), ext/bigdecimal/bigdecimal.h: use unsigned short for rounding mode.
* test/bigdecimal/test_bigdecimal.rb (test_mode): add test for setting rounding mode.
* test/bigdecimal/test_bigdecimal.rb (test_thread_local_mode): add test for setting mode thread-locally.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-26 00:14:18 +00:00
mrkn af8cae1e7f * ext/bigdecimal/bigdecimal.c (BigDecimal_to_f): to_f must underflow when the exponent is less than DBL_MIN_10_EXP - BASE_FIG.
* 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
2010-08-23 16:22:04 +00:00
usa 8eb121d812 * ext/bigdecimal/bigdecimal.h (llabs): never never never never never
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
2010-08-16 01:02:23 +00:00
mrkn 56d3b926ce * ext/bigdecimal/bigdecimal.c (BigDecimal_dump, BigDecimal_inspect, VPrint, VpToString, VpVarCheck): use PRIuSIZE, PRIdSIZE, PRIdVALUE, and PRIxVALUE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-15 09:20:44 +00:00
mrkn 1148f6a327 * ext/bigdecimal/bigdecimal.h (VpVtoD): fix a type of e.
* ext/bigdecimal/bigdecimal.c (BigDecimal_dump, BigDecimal_inspect): fix format for size_t.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28994 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-15 04:32:40 +00:00