summaryrefslogtreecommitdiff
path: root/ext/bigdecimal/bigdecimal.c
AgeCommit message (Collapse)Author
2011-12-18* ext/bigdecimal/bigdecimal.c (Init_bigdecimal): does not follownobu
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
2011-12-07* ext/bigdecimal/bigdecimal.c: Document +@, -@, hash, INFINITY, Nan.drbrain
Patch by Sylvain Daubert. [Ruby 1.9 - Feature #5622] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-02* ext/bigdecimal/bigdecimal.c (VpAllocReal): reduce extra frac.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-04* whitespace cleanup.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33634 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-09* ext/bigdecimal/bigdecimal.c (BigDecimal_abs): Fix comment.ayumin
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-08-17* ext/bigdecimal/bigdecimal.c (cannot_be_coerced_into_BigDecimal):mrkn
remove duplication. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-17Merge branch '5172_bigdecimal_gc_issue' into trunkmrkn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-30* ext/bigdecimal/bigdecimal.c (BigDecimal_version): version 1.1.0.mrkn
* 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-29* remove unused variables.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-26* bigdecimal/bigdecimal.c (VpDup) a new function for duplicatingmrkn
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-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 (VpNewRbClass): fix type of the 2ndmrkn
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* 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 (is_kind_of_BigDecimal): new function tomrkn
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* 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-06-09 * ext/bigdecimal (BigDecimal_to_i): Integer#** may return flonum.tadf
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-31* ext/bigdecimal/bigdecimal.c (GetVpValueWithPrec): remove unusednagachika
variable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31871 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
2011-05-15* remove trailing spaces.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-07cancel subversion backfire. sorrymatz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-07* gc.c (rb_gc_set_params): allow GC parameter configuration bymatz
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-01* ext/bigdecimal/bigdecimal.c (VpMemAlloc): CVE-2011-0188.mrkn
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
2010-09-29* ext/bigdecimal/bigdecimal.c (BIGDECIMAL_ENABLE_VPRINT):mrkn
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* 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-29* ext/bigdecimal/bigdecimal.c (BigDecimal_div2, BigDecimal_add2,usa
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* ext/bigdecimal/bigdecimal.c (VPrint, VpToString): fix format.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29358 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-16* ext/bigdecimal/bigdecimal.h (llabs): never never never never neverusa
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-15* ext/bigdecimal/bigdecimal.c (BigDecimal_dump, BigDecimal_inspect, VPrint, ↵mrkn
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* ext/bigdecimal/bigdecimal.h (VpVtoD): fix a type of e.mrkn
* 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-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-08-11* ext/bigdecimal/bigdecimal.c: don't use // comment.mrkn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28960 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-10* ext/bigdecimal/bigdecimal.c, ext/bigdecimal/bigdecimal.h, ↵mrkn
ext/bigdecimal/extconf.rb: BASE and BASE_FIG are defined based on the size of BDIGIT and renamed. * ext/bigdecimal/bigdecimal.c, ext/bigdecimal/bigdecimal.h: use BDIGIT for Real#frac. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28947 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-10* ext/bigdecimal/bigdecimal.h, ext/bigdecimal/bigdecimal.c: add extern ↵mrkn
declaration of rb_cBigDecimal. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28946 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-02* ext/bigdecimal/bigdecimal.c (BigDecimal_hash): fix type warnings.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28838 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-01* ext/bigdecimal/bigdecimal.c (BigDecimal_hash): use rb_memhash and take ↵mrkn
care of negative finite numbers properly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-18* include/ruby/ruby.h (rb_data_type_t): restructured. [ruby-dev:41862]nobu
add parent member. * error.c (rb_typeddata_inherited_p): new function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28676 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-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