summaryrefslogtreecommitdiff
path: root/test/bigdecimal
AgeCommit message (Collapse)Author
2011-07-10* ext/bigdecimal/bigdecimal.c (rmpd_power_by_big_decimal): fixmrkn
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* ext/bigdecimal/bigdecimal.c (BigDecimal_power): support non-integralmrkn
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-06-27* ext/bigdecimal/bigdecimal.c (BigMath_s_log): move BigMath.log frommrkn
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-17* ext/bigdecimal/bigdecimal.c (BigMath_s_exp): move BigMath.exp frommrkn
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-13* ext/bigdecimal/bigdecimal.c (BigDecimalCmp): use GetVpValueWithPrecmrkn
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-05-31* ext/bigdecimal/bigdecimal.c (GetVpValueWithPrec): support instantiation frommrkn
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* ext/bigdecimal/bigdecimal.c (BigDecimal_coerce): support coerce with amrkn
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* ext/bigdecimal/bigdecimal.c (GetVpValueWithPrec): replace the algorithm formrkn
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* ext/bigdecimal/bigdecimal.c (BigDecimal_new): support instantiation amrkn
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
2010-09-29* ext/bigdecimal/bigdecimal.c (BigDecimal_save_limit):mrkn
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* ext/bigdecimal/bigdecimal.c (BigDecimal_save_rounding_mode):mrkn
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-19* ext/bigdecimal/bigdecimal.c (check_rounding_mode, BigDecimal_mode):mrkn
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-18* ext/bigdecimal/bigdecimal.c (check_rounding_mode): added formrkn
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* ext/bigdecimal/bigdecimal.c: fix rounding algorithms for half-downmrkn
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-08-28* ext/bigdecimal/bigdecimal.c (BigDecimal_save_exception_mode,mrkn
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-26* ext/bigdecimal/bigdecimal.c (Init_bigdecimal, ↵mrkn
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-23* ext/bigdecimal/bigdecimal.c (BigDecimal_to_f): to_f must underflow when ↵mrkn
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-14* ext/bigdecimal/extconf.rb, ext/bigdecimal/bigdecimal.h (labs, llabs): ↵mrkn
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
2010-07-03* ext/bigdecimal/bigdecimal.c (Init_bigdecimal): add two new constants ↵mrkn
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
2010-05-11* ext/bigdecimal/lib/bigdecimal/math.rb (atan), ↵mrkn
test/bigdecimal/test_bigmath.rb (test_atan): explicitly specify the precision for calculating a reciprocal number of an argument. [Bug #3267] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-09* test/bigdecimal/test_bigdecimal.rb (TestBigDecimal#test_gc):nobu
reduced heavy test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27708 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-09* test/bigdecimal/test_bigdecimal.rb (TestBigDecimal#test_gc):nobu
fixed test subject. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27702 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-08* ext/bigdecimal/bigdecimal.c (VpAlloc): ensure buf does not getnobu
collected. based on a patch masaya tarui at [ruby-dev:41213]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27665 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-06* ext/bigdecimal/bigdecimal.c (VpCtoV): fix to check overflow.naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-26* test/bigdecimal/testbase.rb (teardown): should reset all modes.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27496 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-06Surpress warnings.naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-26* ext/bigdecimal/bigdecimal.c (VpCtoV): BigDecimal("0E200000000000")mame
was Infinity, not 0. * test/bigdecimal/test_bigdecimal.rb: add a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26428 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-14* ext/bigdecimal/bigdecimal.c (BigDecimalCmp): Fix comparisons [ruby-core:26646]marcandre
* test/bigdecimal/test_bigdecimal.rb (class): Fix and improve tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-23* ext/bigdecimal/lib/bigdecimal/math.rb (atan): atan(Infinity) isnobu
PI/2. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-21* ext/bigdecimal/bigdecimal.c (GetVpValue): support conversion fromnobu
Rational. [ruby-core:25697] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-20* ext/bigdecimal/lib/bigdecimal/math.rb (sin, cos, atan, exp, log):nobu
improved precision and performance. based on a patch from Makoto Yamashita in [ruby-core:25600] and [ruby-core:25602]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25013 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-17* test/bigdecimal/test_bigdecimal.rb (TestBigDecimal#test_hash):kazu
shut up warning. see [ruby-dev:37437] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20805 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-27* ext/bigdecimal/bigdecimal.c (BigDecimal_DoDivmod): bigdecimalmatz
division (including modulo) should raise ZeroDivisionError as integer division. [incompatible] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20383 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-26* ext/bigdecimal/bigdecimal.c (VpException): bigdecimal zeromatz
division should raise FloatDomainError if mode VP_EXCEPTION_ZERODIVIDE is set. [ruby-dev:37204] * ext/bigdecimal/bigdecimal.c (BigDecimal_mode): should handle VP_EXCEPTION_ZERODIVIDE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-25* ext/bigdecimal/bigdecimal.c (VpAlloc): avoid ALLOCA_N() to avoidmatz
segmentation fault caused by (insanely) long decimal values. [ruby-dev:37189] fix #794 * ext/bigdecimal/bigdecimal.c (BigDecimal_dump, BigDecimal_to_i, BigDecimal_to_f, BigDecimal_to_s, BigDecimal_split, BigDecimal_inspect): ditto. * ext/bigdecimal/bigdecimal.c (VpToString): small performance improvement. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-17* test/bigdecimal/test_bigdecimal.rb (TestBigDecimal#test_sqrt_bigdecimal): matz
test updated. a patch from TAKANO Mitsuhiro <takano32 at jus.or.jp> in [ruby-dev:36736]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19820 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-06* test/bigdecimal/test_bigdecimal.rb (test_sqrt_bigdecimal): testmatz
updated. a patch from TAKANO Mitsuhiro <takano32 at jus.or.jp> in [ruby-dev:36669]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19694 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-30* test/bigdecimal/test_bigdecimal.rb (test_sqrt_bigdecimal): wrongmatz
precision specification. a patch from TAKANO Mitsuhiro <takano32 at jus.or.jp> in [ruby-dev:36634]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19642 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-26* test/bigdecimal/test_bigdecimal.rb (test_inspect): fixed CPU bitnobu
size dependent test. pointed out by TAKANO Mitsuhiro <takano32 AT jus.or.jp>. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-19* prec.c: removed. Precision will be redesigned and be back again.yugui
c.f. [ruby-dev:36352]. * common.mk (COMMON_OBJS): removed prec.o. * inits.c (rb_call_inits): removed Init_Precision. * numeric.c (Init_Numeric): removed inclusion of Precision. removed #induced_from from each class. * rational.c: ditto. * ext/bigdecimal/bigdecimal.c: ditto. * lib/rdoc/knwon_classes.rb: removed the entry for Precision. * test/ruby/test_prec.rb: removed. * test/ruby/test_integer.rb: removed tests for Precision. * test/ruby/test_fixnum.rb: ditto. * test/ruby/test_float.rb: ditto. * test/ruby/test_rational.rb: ditto. * test/ruby/test_complex.rb: ditto. * test/bigdecimal/test_bigdecimal.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-18* ext/bigdecimal/bigdecimal.c (VpCtoV): 1E1000...000 is interpreted asmame
Infinity. [ruby-dev:36159] * ext/bigdecimal/bigdecimal.c (VpPower): Infinity ** 1 returns Infinity instead of NaN. [ruby-dev:36159] * test/bigdecimal/test_bigdecimal.rb: add tests for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19419 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-17* test/bigdecimal/test_bigdecimal.rb: add tests to achieve over 90%mame
test coverage of bigdecimal. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19401 b2dd03c8-39d4-4d8f-98ff-823fe69b080e