summaryrefslogtreecommitdiff
path: root/ext/bigdecimal/bigdecimal.c
AgeCommit message (Collapse)Author
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
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-05-01* ext/bigdecimal/bigdecimal.c (BigDecimal_IsInfinite): don't usenobu
non-ascii character. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-28* ext/bigdecimal: fixed types.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-26* ext/bigdecimal/bigdecimal.c: suppressed warnings.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27494 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-21* ext/bigdecimal/bigdecimal.[ch]: replace _DEBUG with BIGDECIMAL_DEBUG to ↵mrkn
prevent activating debugging code when compiled with -DEBUG flag on Windows. [ruby-core:22989] #1308 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27434 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-16* ext/bigdecimal/bigdecimal.c (BigDecimal_coerce): revert r23389,mame
which not only is unnecessary but also causes the inconsistency of return type. [ruby-core:25706] [Bug #2129] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-17* ext/bigdecimal/bigdecimal.c (BigDecimal_{to_i,mod,divmod,div2}):nobu
removed unused variables. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-16* ext/bigdecimal/bigdecimal.c (VpCtoV): keep e's sign.naruse
When e doesn't over flow e * BASE_FIG but overflow e * 10, e will overflow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26954 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-09* ext/bigdecimal/bigdecimal.c (BigDecimal_divide): fix precision too.mame
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-09* ext/bigdecimal/bigdecimal.c (BigDecimal_DoDivmod): fix precision.mame
[ruby-core:17472][ruby-dev:35372][ruby-dev:40105][ruby-dev:40358] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26626 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-03* ext/bigdecimal/bigdecimal.c (BigDecimal_DoDivmod): get red ofmame
floating point exception. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-03* ext/bigdecimal/bigdecimal.c (BigDecimal_DoDivmod): fix infinitymame
handling. 1 / Infinity was evaluated to NaN. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-28* ext/bigdecimal/bigdecimal.c (BigDecimal_to_i): update RDoc tomatz
denote that #to_i raises FloatDomainError for Inf and NaN. * ext/bigdecimal/bigdecimal.c (BigDecimal_to_i): fast #to_i using BigDecimal_split(). * bignum.c (conv_digit): use faster ISDIGIT() assuming ASCII. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26461 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-26* ext/bigdecimal/bigdecimal.c (BigDecimal_DoDivmod, BigDecimal_mod,mame
BigDecimal_divmod, BigDecimal_div2): BigDecimal#% and #div returned an array itself that was returned by #divmod. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26434 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-26* ext/bigdecimal/bigdecimal.c (VpCtoV): do not raise infinitymame
exception for BigDecimal("0E200000000000"). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26432 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-11-09* string.c (rb_str_each_line): rdoc fixmarcandre
* ext/bigdecimal/bigdecimal.c (#infinite?, #nonzero?): rdoc fix git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e