aboutsummaryrefslogtreecommitdiffstats
path: root/test/bigdecimal/test_bigdecimal.rb
Commit message (Collapse)AuthorAgeFilesLines
* Add frozen_string_literal: false for all filesnaruse2015-12-161-0/+1
| | | | | | When you change this to true, you may need to add more tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_bigdecimal.rb: adjustnobu2015-05-271-2/+2
| | | | | | | * test/bigdecimal/test_bigdecimal.rb (assert_no_memory_leak): fix GC scope and adjust limits. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* bigdecimal.c: wrapper object before allocnobu2015-05-271-0/+27
| | | | | | | | | | * ext/bigdecimal/bigdecimal.c (VpNewRbClass): make wrapper object before result structs allocation and manage refcount for each elements to get rid of potential memory leak. * ext/bigdecimal/bigdecimal.c (BigDecimal_global_new): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/lib/envutil.rb: Moved from test/ruby/.akr2014-11-131-1/+0
| | | | | | | | | | | | | | * test/lib/find_executable.rb: Ditto. * test/lib/memory_status.rb: Ditto. * test/lib/test/unit.rb: require envutil. * test/: Don't require envutil in test files. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/bigdecimal/test_bigdecimal.rb: Add test for mult by nil.headius2014-11-131-0/+6
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/bigdecimal/bigdecimal.c (BigDecimal_divide): Add an additionalmrkn2014-01-131-0/+4
| | | | | | | | | | | digit for the quotient to be compatible with bigdecimal 1.2.1 and the former. [ruby-core:59365] [#9316] [#9305] * test/bigdecimal/test_bigdecimal.rb: tests for the above change. * ext/bigdecimal/bigdecimal.gemspec: bigdecimal version 1.2.4. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44588 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/bigdecimal/bigdecimal.c (VpSetPTR): fix for limitation of the resultingmrkn2013-12-121-0/+19
| | | | | | | | | precision. * test/bigdecimal/test_bigdecimal.rb (test_limit): add tests for the above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bigdecimal.c (BigDecimal_coerce): convert a Float to a BigDecimal insteadmrkn2013-12-081-3/+17
| | | | | | | | | of converting the receiver to a Float. [ruby-core:58756] [Bug #9192] * test/bigdecimal/test_bigdecimal.rb: add tests for the above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/bigdecimal/bigdecimal.c (GetVpValueWithPrec):mrkn2013-12-051-0/+3
| | | | | | | | | | | | treat 0.0 and -0.0 of floating-point numbers specially for an optimization and to correctly propagate its signbit to the result. [Bug #9214] [ruby-core:58858] * test/bigdecimal/test_bigdecimal.rb: add tests case for the above change. * test/bigdecimal/test_bigdecimal_util.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/bigdecimal/bigdecimal.c (BigDecimal_power): Round the result value.mrkn2013-11-221-0/+3
| | | | | | | | [Bug #8818] [ruby-core:56802] * test/bigdecimal/test_bigdecimal.rb: Add a test for the above fix. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/bigdecimal/bigdecimal.c (BigDecimal_sqrt): Fix the precision ofmrkn2013-11-211-0/+14
| | | | | | | | | the result BigDecimal of sqrt. [Bug #5266] [ruby-dev:44450] * test/bigdecimal/test_bigdecimal.rb: add tests for the above changes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/bigdecimal/test_bigdecimal.rb: incorporate BigMath.logheadius2013-11-181-4/+48
| | | | | | tests from JRuby by Peter Vandenabeele. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/bigdecimal/bigdecimal.c (BigMath_s_exp): Fix for the cases whenmrkn2013-06-251-5/+29
| | | | | | | | the argument x is not a BigDecimal. This change is based on the patch made by Garth Snyder. [Fix GH-332] https://github.com/ruby/ruby/pull/332 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41623 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/bigdecimal/bigdecimal.c (BigDecimal_sub):mrkn2013-01-131-0/+40
| | | | | | | | | | | | | | | | | need to specify precision for converting Rational and Float. [ruby-dev:46544] [Bug #7404] * ext/bigdecimal/bigdecimal.c (BigDecimal_mult): ditto. * ext/bigdecimal/bigdecimal.c (BigDecimal_divide): ditto. * ext/bigdecimal/bigdecimal.c (BigDecimal_DoDivmod): ditto. * ext/bigdecimal/bigdecimal.c (BigDecimal_divremain): ditto. * test/bigdecimal/test_bigdecimal.rb: add tests for the above fixes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38801 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/bigdecimal/bigdecimal.c (rmpd_power_by_big_decimal):mrkn2013-01-071-0/+6
| | | | | | | | | | add RB_GC_GUARD to prevent the immediate object is GCed too early. This patch was made by Yusuke Endoh. [Bug #7044] [ruby-core:47632] * test/bigdecimal/test_bigdecimal.rb: add a reproduction test for the issue [Bug #7044] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/bigdecimal/bigdecimal.c (BigDecimal_new): stop checking stringmrkn2012-12-021-0/+14
| | | | | | taintness. [Bug #5508] [ruby-core:40510] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/bigdecimal/bigdecimal.c (BigDecimal_new),mrkn2012-11-011-0/+12
| | | | | | | test/bigdecimal/test_bigdecimal.rb: Fix exception message of BigDecimal constructor with a Float. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/bigdecimal/bigdecimal.c (BigDecimal_add),mrkn2012-11-011-0/+4
| | | | | | | | test/bigdecimal/test_bigdecimal.rb: need to specify precision for converting Rational and Float. [ruby-core:48045] [Bug #7176] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37406 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/bigdecimal/test_bigdecimal.rb (TestBigDecimal#test_to_f): addedusa2012-08-311-0/+5
| | | | | | | for previous commit. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* bigdecimal.c: check underflownobu2012-08-301-6/+26
| | | | | | | | * ext/bigdecimal/bigdecimal.c (BigDecimal_to_f): check underflow since strtod() sets errno to ERANGE at underflow too. [ruby-core:47342] [Bug #6944] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Add a test: BigDecimal("0").div(BigDecimal("Infinity")).naruse2012-05-111-0/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/bigdecimal/bigdecimal.c (Init_bigdecimal): define IDs beforenaruse2012-05-071-0/+6
| | | | | | they are used. [ruby-core:44900] [Bug #6406] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35555 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Run separate process if the test uses GC.stress.naruse2012-04-181-20/+21
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35376 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/bigdecimal/bigdecimal.c (GetVpValueWithPrec): since methodsnobu2012-02-271-0/+7
| | | | | | | | can be overridden, so should not make an assumption on the type of results. [ruby-core:42969][Bug #6093] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34829 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/bigdecimal/bigdecimal.c (BigDecimal_s_allocate): follownobu2011-12-211-4/+19
| | | | | | | Allocation Framework. [Bug #5775] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34089 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/bigdecimal/bigdecimal.c (Init_bigdecimal): does not follownobu2011-12-181-0/+4
| | | | | | | allocation framework right now. [ruby-core:41710] [Bug #5773] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34070 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Merge branch '5172_bigdecimal_gc_issue' into trunkmrkn2011-08-171-1/+44
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/bigdecimal/test_bigdecimal.rb (test_version): removed.mrkn2011-07-301-4/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32762 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bigdecimal/bigdecimal.c (VpDup) a new function for duplicatingmrkn2011-07-261-0/+26
| | | | | | | | | | 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
* * ext/bigdecimal/bigdecimal.c (rmpd_power_by_big_decimal): fixmrkn2011-07-101-0/+14
| | | | | | | | | | 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
* * ext/bigdecimal/bigdecimal.c (BigDecimal_power): support non-integralmrkn2011-07-101-24/+196
| | | | | | | | | | | | | | | | | 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
* * ext/bigdecimal/bigdecimal.c (BigMath_s_log): move BigMath.log frommrkn2011-06-271-0/+85
| | | | | | | | | | 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
* * ext/bigdecimal/bigdecimal.c (BigMath_s_exp): move BigMath.exp frommrkn2011-06-171-0/+52
| | | | | | | | | | 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
* * ext/bigdecimal/bigdecimal.c (BigDecimalCmp): use GetVpValueWithPrecmrkn2011-06-131-1/+6
| | | | | | | | | | 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
* * ext/bigdecimal/bigdecimal.c (GetVpValueWithPrec): support instantiation frommrkn2011-05-311-0/+16
| | | | | | | | | | 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
* * ext/bigdecimal/bigdecimal.c (BigDecimal_coerce): support coerce with amrkn2011-05-311-0/+6
| | | | | | | | | 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
* * ext/bigdecimal/bigdecimal.c (GetVpValueWithPrec): replace the algorithm formrkn2011-05-311-0/+12
| | | | | | | | | | | | | 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
* * ext/bigdecimal/bigdecimal.c (BigDecimal_new): support instantiation amrkn2011-05-311-0/+14
| | | | | | | | | | | | 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
* * ext/bigdecimal/bigdecimal.c (BigDecimal_save_limit):mrkn2010-09-291-0/+2
| | | | | | | | 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
* * ext/bigdecimal/bigdecimal.c (BigDecimal_save_rounding_mode):mrkn2010-09-291-0/+4
| | | | | | | | | | 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
* * ext/bigdecimal/bigdecimal.c (check_rounding_mode, BigDecimal_mode):mrkn2010-09-191-3/+4
| | | | | | | | 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
* * ext/bigdecimal/bigdecimal.c (check_rounding_mode): added formrkn2010-09-181-6/+32
| | | | | | | | | | 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
* * ext/bigdecimal/bigdecimal.c: fix rounding algorithms for half-downmrkn2010-09-181-0/+12
| | | | | | | | 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
* * ext/bigdecimal/bigdecimal.c (BigDecimal_save_exception_mode,mrkn2010-08-281-0/+36
| | | | | | | | 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
* * ext/bigdecimal/bigdecimal.c (Init_bigdecimal, ↵mrkn2010-08-261-0/+35
| | | | | | | | | | | | 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
* * ext/bigdecimal/bigdecimal.c (BigDecimal_to_f): to_f must underflow when ↵mrkn2010-08-231-0/+10
| | | | | | | | 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
* * ext/bigdecimal/extconf.rb, ext/bigdecimal/bigdecimal.h (labs, llabs): ↵mrkn2010-08-141-1/+1
| | | | | | | | | support environments missing labs and llabs. * ext/bigdecimal/bigdecimal.h (vabs): added. * ext/bigdecimal/extconf.rb, ext/bigdecimal/bigdecimal.h, ext/bigdecimal/bigdecimal.c, test/bigdecimal/test_bigdecimal.rb (TestBigDecimal#test_new): replace U_LONG, S_LONG, S_INT, and U_INT with appropreate standard or ruby-provided types. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/bigdecimal/bigdecimal.c (Init_bigdecimal): add two new constants ↵mrkn2010-07-031-0/+8
| | | | | | | | BigDecimal::INFINITY and BigDecimal::NAN. * ext/bigdecimal/lib/bigdecimal/math.rb (BigMath.exp): modify the behaviors for infinity arguments as same as Math.exp. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/bigdecimal/test_bigdecimal.rb (TestBigDecimal#test_gc):nobu2010-05-091-1/+1
| | | | | | | reduced heavy test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27708 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/bigdecimal/test_bigdecimal.rb (TestBigDecimal#test_gc):nobu2010-05-091-1/+1
| | | | | | | fixed test subject. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27702 b2dd03c8-39d4-4d8f-98ff-823fe69b080e