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

512 Коммитов

Автор SHA1 Сообщение Дата
mrkn 61e58f7dc4 bigdecimal: version 1.3.3
Import bigdecimal version 1.3.3.  The full commit log is here:

  https://github.com/ruby/bigdecimal/compare/v1.3.2...v1.3.3

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-13 15:28:30 +00:00
nobu 1852b4a866 ext: check if null byte is contained
[ruby-dev:50267] [Bug #13953]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-30 08:35:23 +00:00
nobu 65b87de350 ruby.h: unnormalized Fixnum value
* include/ruby/ruby.h (ST2FIX): fix unnormalized Fixnum value bug
  on mingw/mswin.  [ruby-core:82687] [Bug #13877]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-07 03:24:08 +00:00
mrkn 65285fbdb8 bigdecimal: version 1.3.2
Import bigdecimal version 1.3.2.  The full commit log is here:

  https://github.com/ruby/bigdecimal/compare/v1.3.1...v1.3.2

This fixes [ruby-core:79603] [Bug #13232]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-13 06:03:18 +00:00
mrkn 70f772c3ef bigdecimal: version 1.3.1
Import bigdecimal version 1.3.1.  The full commit log is here:

  https://github.com/ruby/bigdecimal/compare/v1.3.0...v1.3.1

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57597 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-10 13:23:58 +00:00
mrkn bd288dcc8b bigdecimal: version 1.3.0
Import bigdecimal version 1.3.0.  The full commit log is here:

  https://github.com/ruby/bigdecimal/compare/v1.3.0.pre.2...v1.3.0

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57145 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-21 15:35:29 +00:00
mrkn 42a677c895 bigdecimal: version 1.3.0.pre.2
Import bigdecimal version 1.3.0.pre.2.  The full commit log is here:

  https://github.com/ruby/bigdecimal/compare/v1.3.0.pre...v1.3.0.pre.2

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-10 08:56:05 +00:00
mrkn 8e1293730e bigdecimal: import version 1.3.0.pre
Import bigdecimal version 1.3.0.pre.  The full commit log of this
changes can be found at:

    https://github.com/ruby/bigdecimal/compare/5c43a9e...v1.3.0.pre

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-10 07:49:15 +00:00
mrkn 03c9bc2b1d Import from ruby/bigdecimal repository
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56550 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-03 12:46:22 +00:00
nobu 4e44f6ef86 [DOC] replace Fixnum with Integer [ci skip]
* numeric.c: [DOC] update document for Integer class.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-26 06:11:23 +00:00
nobu cc80f139cd bigdecimal.c: more precision
* ext/bigdecimal/bigdecimal.c (BigDecimal_div2): need more room
  for precision to round.  [ruby-core:77475] [Bug #12805]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-04 00:55:15 +00:00
nobu 1ae50df95d bigdecimal.c: fix debug print
* ext/bigdecimal/bigdecimal.c (VpFree, VpInit): fix debug print
  format.

* ext/bigdecimal/bigdecimal.c (VPrint): fix argument description,
  and embed NaN, Infinity, and zero in the format.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-04 00:55:14 +00:00
kazu 07efce075b Use https instead of http in some URLs
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56135 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-11 10:33:36 +00:00
nobu c79c06fa1c Integer conversion
* ext/bigdecimal/bigdecimal.c: use NUM2INT and NUM2USHORT to
  reject nil.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55438 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-18 02:25:28 +00:00
nobu 871472c72b Unnecessary checks
* ext/bigdecimal/bigdecimal.c: FIX2INT and FIX2UINT imply the
  check for Fixnum.

* ext/zlib/zlib.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-17 08:45:05 +00:00
nobu 88cc25f96d missing.h: isfinite
* include/ruby/missing.h (isfinite): move from numeric.c.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55136 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-23 12:33:39 +00:00
usa b9da060bd8 * ext/bigdecimal/bigdecimal.c (isfinite): get rid of a warning on
cygwin. [Bug #12417][ruby-core:75691]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55133 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-23 11:21:11 +00:00
usa 921ff3029b * ext/bigdecimal/bigdecimal.c (isfinite): isfinite does not always
exist.  fixed build error on Windows itroduced at r55123.

I found that more complex definition of isfinite in numeric.c.
But it's unused because it inplicitly checks not defined _WIN32.
I don't know why the code do that.
IMO, the definition of isfinite should be put at missing.h.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55129 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-23 06:55:48 +00:00
nobu 4a574f7ad9 bigdecimal.c: fix FloatDomainError
* ext/bigdecimal/bigdecimal.c (GetVpValueWithPrec): consider
  non-finite float values not to raise FloatDomainError.
  [ruby-core:75682] [Bug #12414]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-23 03:30:30 +00:00
hsbt 0e382a3dd8 * encoding.c: Fix return value of `Encoding::ISO8859_1.name`
[Bug #12313][ruby-core:75147][ci skip]
* ext/bigdecimal/bigdecimal.c: Fix code sample of `BigDecimal.new`

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-25 02:17:54 +00:00
akr 9d8ef4ea20 Update dependencies.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-11 11:50:00 +00:00
mrkn d9bddfda03 * ext/bigdecimal/bigdecimal.gemspec: bump version to 1.2.8.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-22 12:20:28 +00:00
naruse c4fdfabcc8 handle ext/ as r53141
g -L frozen_string_literal ext/**/*.rb|xargs ruby -Ka -e'ARGV.each{|fn|puts
fn;open(fn,"r+"){|f|s=f.read.sub(/\A(#!.*\n)?(#.*coding.*\n)?/,"\\&#
frozen_string_literal: false\n");f.rewind;f.write s}}'

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16 05:31:54 +00:00
ko1 dff42b0ea0 * ext/**/*.c (*_memsize): same as r52986 for extensions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-09 01:01:17 +00:00
hsbt d1decf0dfe * ext/bigdecimal/bigdecimal.c: Fix double word typo.
[ci skip][fix GH-1120] Patch by @jwworth

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-02 01:36:30 +00:00
nobu 859314cbc6 bigdecimal.c: suppress warnings
* ext/bigdecimal/bigdecimal.c (AddExponent): suppress
  strict-overflow warnings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-08 06:29:13 +00:00
nobu 57e2877e7b ext: use RARRAY_AREF
* ext/**/*.c: prefer RARRAY_AREF to indexing RARRAY_CONST_PTR.
  pointed out by hanmac.
  https://github.com/ruby/ruby/commit/3553a86#commitcomment-14187670

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52453 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-05 01:09:17 +00:00
nobu 3553a86eb5 ext: use RARRAY_CONST_PTR
* ext/bigdecimal/bigdecimal.c: use RARRAY_CONST_PTR just fore
  reference instead of RARRAY_PTR, to keep the array WB-protected.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-04 07:27:10 +00:00
hsbt 7c34b471be * ext/bigdecimal/bigdecimal.gemspec: Fix require paths for released gem.
[fix GH-929] Patch by @voxik
* ext/io/console/io-console.gemspec: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-13 02:35:25 +00:00
nobu bdf07741f3 bigdecimal.c: wrapper object before alloc
* 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
2015-05-27 08:02:28 +00:00
mrkn 8b9db31f94 * bigdecimal: conform to ruby's license. [ruby-core:68466] [Bug #10952]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50185 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-08 07:18:46 +00:00
nobu a44f7a3ee6 bigdecimal.c: format specifiers
* ext/bigdecimal/bigdecimal.c (VpInit, VpPower, VpVarCheck): fix
  format specifiers of BDIGIT.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-04 07:32:58 +00:00
nobu 718b425306 bigdecimal.c: fix a typo
* ext/bigdecimal/bigdecimal.c (VpSetPTR): fix a typo, 'expoennt'
  to 'exponent'.  [ruby-core:67980] [Bug #10823] [Fix GH-825]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49491 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-04 07:32:43 +00:00
mrkn 78400919ba * ext/bigdecimal/bigdecimal.c (rb_rational_num): add fallback function
for rubies lower than 2.2.0.

* ext/bigdecimal/bigdecimal.c (rb_rational_den): ditto.

* ext/bigdecimal/extconf.rb: check the existences of struct RRational,
  rb_rational_num, and rb_rational_den.

* ext/bigdecimal/bigdecimal.bundle: bump version.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-29 14:34:43 +00:00
hsbt 60c580fdcd * ext/bigdecimal/bigdecimal.c: fixes documentation like labeled lists,
code examples etc. [ruby-core:66730][Bug #10576][ci skip]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49219 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-12 04:50:55 +00:00
nobu d5b81e6844 fix printf format conversion specifiers
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-26 05:33:01 +00:00
mrkn 4935c13054 * ext/bigdecimal/depend: Fix dependencies to make bigdecimal
installable by rubygems.

* ext/bigdecimal/bigdecimal.gemspec: version 1.2.6.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-19 13:15:28 +00:00
nobu e580a631be use 0 for reserved
use 0 for rb_data_type_t::reserved instead of NULL, since its type
may be changed in the future and possibly not a pointer type.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-01 06:38:04 +00:00
akr 6ca202fcee Update dependency.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-21 03:04:44 +00:00
akr dd547e1b22 Mark auogenerated part.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-15 11:14:08 +00:00
akr 57682b05e1 * common.mk: Remove comments in Dependency lines.
Notified by usa.

* enc/depend: Ditto.

* ext/**/depend: Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48434 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-15 10:28:25 +00:00
akr 8727eb77be * tool/update-deps: Extend to fix dependencies.
* common.mk: Dependencies updated by tool/update-deps.

* enc/depend: Ditto.

* ext/**/depend: Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-15 05:15:49 +00:00
mrkn bf3d294ae8 * ext/bigdecimal/bigdecimal.c: [DOC] Add description of
`BigDecimal.new` exceptions.  Patched by @joker1007 and
  @prathamesh-sonpatki [Fixes GH-690]
  https://github.com/ruby/ruby/pull/690

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-31 22:36:16 +00:00
nobu 38f013391d bigdecimal/math.rb: error message in BigMath#PI
* ext/bigdecimal/lib/bigdecimal/math.rb (BigMath#PI): change error
  message about zero or negative precision for clarity and
  consistency with other methods.  [GH-644]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46600 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-28 11:29:11 +00:00
akr e56d2c385a * include/ruby/ruby.h: Hide Rational internal.
(RRational): Moved to internal.h
  (RRATIONAL): Ditto.
  (RRATIONAL_SET_NUM): Moved to rational.c.
  (RRATIONAL_SET_DEN): Ditto.

* rational.c (rb_rational_num): New function.
  (rb_rational_den): Ditto.

* include/ruby/intern.h (rb_rational_num): Declared.
  (rb_rational_den): Ditto.

*  ext/bigdecimal/bigdecimal.c: Follow the above change.

* ext/date/date_core.c: Ditto.

  [ruby-core:60665] [Feature #9513]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-17 16:37:41 +00:00
nobu 1f29e8e2ba class.c: do nothing if copying self
* class.c (rb_mod_init_copy): do nothing if copying self.
  [ruby-dev:47989] [Bug #9535]
* hash.c (rb_hash_initialize_copy): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-21 11:42:03 +00:00
mrkn 260cdec9a9 * ext/bigdecimal/bigdecimal.c (BigDecimal_initialize): Insert GC guard.
* ext/bigdecimal/bigdecimal.c (BigDecimal_global_new): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-16 17:14:11 +00:00
nobu beb2d4c5a5 bigdecimal.c: refine macros
* ext/bigdecimal/bigdecimal.c (PUSH, SAVE): remove extra
  semicolons.

* ext/bigdecimal/bigdecimal.c (GUARD_OBJ): add parentheses and
  make an expression instead of a statement.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45002 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-16 07:53:18 +00:00
akr 037ceae571 * ext/bigdecimal/bigdecimal.c (BIGNUM_ZERO_P): Unused macro removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-15 22:48:43 +00:00
akr 3c99764bcd * internal.h: Rename macro names: RBIGNUM_FOO to BIGNUM_FOO.
(BIGNUM_EMBED_LEN_NUMBITS): Renamed from RBIGNUM_EMBED_LEN_NUMBITS.
  (BIGNUM_EMBED_LEN_MAX): Renamed from RBIGNUM_EMBED_LEN_MAX.
  (BIGNUM_SIGN_BIT): Renamed from RBIGNUM_SIGN_BIT.
  (BIGNUM_SIGN): Renamed from RBIGNUM_SIGN.
  (BIGNUM_SET_SIGN): Renamed from RBIGNUM_SET_SIGN.
  (BIGNUM_POSITIVE_P): Renamed from RBIGNUM_POSITIVE_P.
  (BIGNUM_NEGATIVE_P): Renamed from RBIGNUM_NEGATIVE_P.
  (BIGNUM_EMBED_FLAG): Renamed from RBIGNUM_EMBED_FLAG.
  (BIGNUM_EMBED_LEN_MASK): Renamed from RBIGNUM_EMBED_LEN_MASK.
  (BIGNUM_EMBED_LEN_SHIFT): Renamed from RBIGNUM_EMBED_LEN_SHIFT.
  (BIGNUM_LEN): Renamed from RBIGNUM_LEN.
  (RBIGNUM_DIGITS): Renamed from RBIGNUM_DIGITS.
  (BIGNUM_LENINT): Renamed from RBIGNUM_LENINT.

* bignum.c: Follow the above change.

* gc.c: Ditto.

* marshal.c: Ditto.

* math.c: Ditto.

* numeric.c: Ditto.

* random.c: Ditto.

* rational.c: Ditto.

* sprintf.c: Ditto.

* ext/-test-/bignum/bigzero.c: Ditto.

* ext/-test-/bignum/intpack.c: Ditto.

* ext/bigdecimal/bigdecimal.c: Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-15 21:17:34 +00:00
nobu 4cac2f4ada bigdecimal.h: suppress warnings
* ext/bigdecimal/bigdecimal.h (VpSetZero, VpSetInf): get rid of
  unused-value warnings by gcc 4.9.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44915 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-12 02:25:28 +00:00
akr 09e6766d1a * ext/bigdecimal/bigdecimal.c (BigMath_s_log): Use rb_big_cmp instead of
RBIGNUM_NEGATIVE_P.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-11 14:55:37 +00:00
akr c1de2f4e3a * bignum.c (rb_big_cmp): Specialize a comparison to zero.
* ext/bigdecimal/bigdecimal.c (is_negative): Use rb_big_cmp instead of
  RBIGNUM_NEGATIVE_P.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44910 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-11 14:43:23 +00:00
mrkn 986a99b239 * ext/bigdecimal/bigdecimal.gemspec: bigdecimal version 1.2.5.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-15 15:17:33 +00:00
nobu f5a12ac596 bigdecimal.c: rename macros
* ext/bigdecimal/bigdecimal.c (RB_OBJ_CLASSNAME): rename from CLASS_NAME().

* ext/bigdecimal/bigdecimal.c (RB_OBJ_STRING): for object itself.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-15 08:16:33 +00:00
nobu 0a8988c132 bigdecimal.c: backword compatibility as gem
* ext/bigdecimal/bigdecimal.c (CLASS_NAME): macro to wrap
  depending on PRIsVALUE for 1.9.  [Backport #9406]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-14 06:58:43 +00:00
nobu 88383b058b bigdecimal.c: backword compatibility as gem
* ext/bigdecimal/bigdecimal.c (DECIMAL_SIZE_OF_BITS): fallback
  definition for 2.1 or older.  [ruby-core:59750] [Backport #9406]
* ext/bigdecimal/bigdecimal.c (raise_with_class): fallback definition
  for 1.9.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-14 05:51:58 +00:00
mrkn e7fe5648cf * ext/bigdecimal/bigdecimal.c (BigDecimal_divide): Add an additional
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
2014-01-13 17:29:58 +00:00
nobu eadaa8ba8b ext: use PRIsVALUE for rb_raise and rb_warn
* ext/bigdecimal/bigdecimal.c (BigDecimal_new): use PRIsVALUE for
  rb_raise() and rb_warn().
* ext/openssl/ossl_cipher.c (ossl_cipher_init): ditto.
* ext/racc/cparse/cparse.c (extract_user_token): ditto.
* ext/syslog/syslog.c (mSyslog_log): ditto.

* ext/openssl/ossl.h (OSSL_Check_Kind, OSSL_Check_Instance): now
  ossl_raise() also accepts PRIsVALUE.
* ext/openssl/ossl_asn1.c (ossl_asn1_default_tag):

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-13 00:57:38 +00:00
nobu 5e9b7bacc3 ruby/util.h: DECIMAL_SIZE_OF_BITS
* include/ruby/util.h (DECIMAL_SIZE_OF_BITS): a preprocessor
  constant macro to approximate decimal representation size of n-bits
  integer.
* iseq.c (register_label): use DECIMAL_SIZE_OF_BITS for better
  approximation.
* ext/bigdecimal/bigdecimal.c (BigMath_s_log): ditto.
* common.mk (iseq.o), ext/bigdecimal/depend (bigdecimal.o): add
  dependency to ruby/util.h for DECIMAL_SIZE_OF_BITS.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-12 00:21:37 +00:00
nobu 2b1c47dadc bigdecimal.c: expand buffer
* ext/bigdecimal/bigdecimal.c (BigMath_s_log): expand buffer size for
  64bit platforms.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-11 03:15:01 +00:00
eregon 1cc709a84a * ext/bigdecimal: update class method call style from :: to .
in documentation and usage.
* ext/bigdecimal/lib/bigdecimal/math.rb: [DOC] fix examples values.
  Computations were made using ruby 2.0.0p247 to ensure
  no effect of the recent BigDecimal bug.
* ext/bigdecimal/sample/nlsolve.rb: fix indent.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-02 15:10:13 +00:00
mrkn df33325192 * ext/bigdecimal/bigdecimal.c (VpSetPTR): fix for limitation of the resulting
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
2013-12-12 17:02:27 +00:00
mrkn 7d3538db3f * ext/bigdecimal/bigdecimal.c (VpAddAbs): put out a conditional branch from
the inside of while-loop.

* ext/bigdecimal/bigdecimal.c (VpSubAbs): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-12 17:02:24 +00:00
mrkn 27d53fb5df * ext/bigdecimal/bigdecimal.c (VPrint): be a static function, support another
dump formats, and add more information of the given bigdecimal.

* ext/bigdecimal/bigdecimal.h: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-12 17:02:20 +00:00
mrkn 0727a22c69 * bigdecimal.c (BigDecimal_coerce): convert a Float to a BigDecimal instead
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
2013-12-08 11:20:51 +00:00
mrkn 2308fb170e * ext/bigdecimal/bigdecimal.c (GetVpValueWithPrec):
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
2013-12-05 16:34:59 +00:00
nobu 78acdaca3c bigdecimal.gemspec: date
* ext/bigdecimal/bigdecimal.gemspec: revert Gem::Specification#date
  for snapshot/release tarballs.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-26 01:57:55 +00:00
zzak b514742374 * ext/bigdecimal/bigdecimal.gemspec: bump BigDecimal to 1.2.3 for
proper release date in RubyGems


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43842 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-25 05:35:18 +00:00
zzak a7925537d4 * ext/bigdecimal/bigdecimal.gemspec: Remove Gem::Specification#date
We should rely on rubygems to create the date the gem was released
  for each version.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43841 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-25 05:25:53 +00:00
mrkn 10ca8a4b07 * ext/bigdecimal/bigdecimal.c (BigDecimal_power): Use FIX2LONG instead
of FIX2INT to avoid conversion error.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-23 16:08:23 +00:00
mrkn b8bbc1a310 * ext/bigdecimal/lib/bigdecimal/math.rb (BigMath.E): Use BigMath.exp.
[Feature #6857] [ruby-core:47130]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43817 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-23 10:52:40 +00:00
mrkn b09f41587c exp
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43816 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-23 10:49:36 +00:00
mrkn 926960b01b * ext/bigdecimal/bigdecimal.c (BigDecimal_div2): The signature was
changed to allow us to pass arguments directly.

* ext/bigdecimal/bigdecimal.c (BigDecimal_div3): Added for the role of
  the old BigDecimal_div2.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43815 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-23 10:36:40 +00:00
mrkn 909d14a1db * ext/bigdecimal/bigdecimal.c (BigDecimal_power):
Round the result value only if the precision is given.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43803 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-22 13:31:26 +00:00
mrkn 4fb888211a * ext/bigdecimal/bigdecimal.gemspec: version 1.2.2.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43799 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-22 08:07:43 +00:00
mrkn 15185e875d * ext/bigdecimal/bigdecimal.c (BigDecimal_data_type):
Use RUBY_TYPED_FREE_IMMEDIATELY only if it is available.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43798 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-22 08:05:58 +00:00
mrkn 2043bb5c34 * ext/bigdecimal/bigdecimal.c (BigDecimal_power): Round the result value.
[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
2013-11-22 07:52:17 +00:00
mrkn 5ff5938120 * ext/bigdecimal/bigdecimal.c (BigMath_s_exp): Insert rb_thread_check_ints.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-22 05:55:45 +00:00
mrkn 467c9ec3b7 * ext/bigdecimal/bigdecimal.c (BigMath_s_exp): Fix the inserting points
of RB_GC_GUARDs.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43790 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-22 05:54:05 +00:00
mrkn 4131c29f87 * ext/bigdecimal/bigdecimal.c: Fix indentation.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-22 05:50:34 +00:00
mrkn b6f664686e * ext/bigdecimal/bigdecimal.c (VpAlloc): Fix the expr to adjust the size
of the digit array.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-21 12:42:01 +00:00
mrkn ff3e585014 * ext/bigdecimal/bigdecimal.c (BigDecimal_sqrt): Fix the precision of
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
2013-11-21 12:37:46 +00:00
nagachika 6cbe261626 * ext/bigdecimal/lib/bigdecimal/util.rb: [DOC] remove example of
Rational#to_d without argument. [Bug #8958]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-14 14:40:53 +00:00
zzak 62d3853475 * ext/bigdecimal/lib/bigdecimal/util.rb: [DOC] +precision+ is required
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-13 16:12:32 +00:00
zzak a369b7f7cb * ext/bigdecimal/lib/bigdecimal/util.rb: [DOC] Document the required
+precision+ argument for Rational#to_d [Bug #8958]
-This line, and those below, will be ignored--

M    ChangeLog
M    ext/bigdecimal/lib/bigdecimal/util.rb


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-13 10:23:14 +00:00
ko1 c5e08b764e * add RUBY_TYPED_FREE_IMMEDIATELY to data types which only use
safe functions during garbage collection such as xfree().
  On default, T_DATA objects are freed at same points as fianlizers.
  This approach protects issues such as reported by [ruby-dev:35578].
  However, freeing T_DATA objects immediately helps heap usage.
  Most of T_DATA (in other words, most of dfree functions) are safe.
  However, we turned off RUBY_TYPED_FREE_IMMEDIATELY by default
  for safety.
* cont.c: ditto.
* dir.c: ditto.
* encoding.c: ditto.
* enumerator.c: ditto.
* error.c: ditto.
* file.c: ditto.
* gc.c: ditto.
* io.c: ditto.
* iseq.c: ditto.
* marshal.c: ditto.
* parse.y: ditto.
* proc.c: ditto.
* process.c: ditto.
* random.c: ditto.
* thread.c: ditto.
* time.c: ditto.
* transcode.c: ditto.
* variable.c: ditto.
* vm.c: ditto.
* vm_backtrace.c: ditto.
* vm_trace.c: ditto.
* ext/bigdecimal/bigdecimal.c: ditto.
* ext/objspace/objspace.c: ditto.
* ext/stringio/stringio.c: ditto.
* ext/strscan/strscan.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-29 11:16:54 +00:00
zzak 8603fdcc62 * ext/bigdecimal/bigdecimal.c: [DOC] several fixes by @chastell
This includes fixing the capitalization of Infinity, return value of
  example "BigDecimal.new('NaN') == 0.0", and code style in example.
  [Fixes GH-398] https://github.com/ruby/ruby/pull/398


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-26 13:13:59 +00:00
nobu 3f78d84661 Eliminate less-than-zero checks for unsigned variables
* ext/bigdecimal/bigdecimal.c, ext/digest/md5/md5.c,
  ext/json/fbuffer/fbuffer.h, ext/json/generator/generator.c:
  Eliminate less-than-zero checks for unsigned variables.
  According to section 4.1.5 of C89 standard, size_t is an unsigned
  type.  These checks were found with 'cppcheck' static analysis tool.
  [ruby-core:57117] [Feature #8890]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-12 13:37:11 +00:00
zzak f3a63c3175 * ext/bigdecimal/lib/bigdecimal/util.rb: [DOC] document top-level
classes from BigDecimal utils native extensions


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-15 23:16:26 +00:00
mrkn d08a79cfe1 * ext/bigdecimal/bigdecimal.h (RB_UNUSED_VAR, UNREACHABLE):
import macros from ruby.h for 1.9.3.
  [Bug #8588] [ruby-core:55730]

* ext/bigdecimal/bigdecimal.gemspec: Bump version to 1.2.1.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-01 11:46:15 +00:00
charliesome 685f91236c * ext/bigdecimal/bigdecimal.c (BigDecimal_save_rounding_mode): fix typo.
Fixes GH-343. Patch by @jgarber.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-26 14:54:36 +00:00
mrkn 448c66c516 * ext/bigdecimal/bigdecimal.c (BigMath_s_exp): Fix for the cases when
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
2013-06-25 12:29:00 +00:00
akr a461f2f8bb * ext/bigdecimal: Workaround fix for bigdecimal test failures caused
by [ruby-dev:47413] [Feature #8509]

* ext/bigdecimal/bigdecimal.h (BDIGIT): Make it independent from the
  definition for bignum.c.
  (SIZEOF_BDIGITS): Ditto.
  (BDIGIT_DBL): Ditto.
  (BDIGIT_DBL_SIGNED): Ditto.
  (PRI_BDIGIT_PREFIX): Undefine the definition.
  (PRI_BDIGIT_DBL_PREFIX): Ditto.

* ext/bigdecimal/bigdecimal.c (RBIGNUM_ZERO_P): Use rb_bigzero_p.
  (bigzero_p): Removed.
  (is_even): Use rb_big_pack.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41502 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-20 15:42:23 +00:00
zzak 54a22fb8c7 * ext/bigdecimal/bigdecimal.c: Update overview formatting of headers
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-15 01:20:27 +00:00
zzak 184eaedb3a * ext/bigdecimal/bigdecimal.gemspec: Update authors
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41308 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-15 01:19:30 +00:00
zzak 51c43dba6a * ext/bigdecimal/*: improve documentation, nodoc samples with @mrkn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-13 14:44:25 +00:00
mrkn 1699396fe5 * ext/bigdecimal/lib/bigdecimal/util.rb (Float#to_d): fix the number
of figures.  Patch by Vipul A M <vipulnsward@gmail.com>.
  https://github.com/ruby/ruby/pull/323  fix GH-323

* test/bigdecimal/test_bigdecimal_util.rb: fix for the above change.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-04 06:37:44 +00:00
mrkn 1db209763a * ext/bigdecimal/bigdecimal.c (BigDecimal_power): use rb_dbl2big
to convert a double value to a Bignum.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-31 16:59:09 +00:00
zzak 2439bc9e69 * ext/bigdecimal/bigdecimal.c: Formatting for BigMath [Fixes GH-306]
Based on a patch by @eLobato.
* ext/bigdecimal/lib/bigdecimal/math.rb: ditto


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-19 21:00:43 +00:00
ktsj edb98f8b91 fix typos. Patch by k_takata.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-19 03:10:21 +00:00
akr b47138580c * lib/mkmf.rb: Add ruby/ruby.h, ruby/missing.h, ruby/intern.h,
ruby/st.h and ruby/subst.h for ruby_headers in generated Makefile.

* ext/-test-/old_thread_select/depend: Update dependencies.

* ext/-test-/wait_for_single_fd/depend: Ditto.

* ext/bigdecimal/depend: Ditto.

* ext/curses/depend: Ditto.

* ext/digest/bubblebabble/depend: Ditto.

* ext/digest/depend: Ditto.

* ext/digest/md5/depend: Ditto.

* ext/digest/rmd160/depend: Ditto.

* ext/digest/sha1/depend: Ditto.

* ext/digest/sha2/depend: Ditto.

* ext/dl/callback/depend: Ditto.

* ext/dl/depend: Ditto.

* ext/etc/depend: Ditto.

* ext/nkf/depend: Ditto.

* ext/objspace/depend: Ditto.

* ext/pty/depend: Ditto.

* ext/readline/depend: Ditto.

* ext/ripper/depend: Ditto.

* ext/sdbm/depend: Ditto.

* ext/socket/depend: Ditto.

* ext/stringio/depend: Ditto.

* ext/strscan/depend: Ditto.

* ext/syslog/depend: Ditto.

* ext/-test-/num2int/depend: Removed.

* ext/dbm/depend: Ditto.

* ext/fcntl/depend: Ditto.

* ext/gdbm/depend: Ditto.

* ext/racc/cparse/depend: Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-13 00:46:29 +00:00
akr 3f9e0e43c3 * ext/bigdecimal/bigdecimal.c (VpCtoV): Initialize a local variable
even when overflow.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40215 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-10 08:39:53 +00:00
akr fa9b5bf223 * bignum.c (rb_ll2big): Don't overflow on signed integer negation.
* ext/bigdecimal/bigdecimal.c (MUL_OVERFLOW_SIGNED_VALUE_P): New
  macro.
  (AddExponent): Don't overflow on signed integer multiplication.
  (VpCtoV): Don't overflow on signed integer arithmetic.
  (VpCtoV): Don't overflow on signed integer arithmetic.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-10 03:34:38 +00:00
hsbt 0cfc4866d4 code cleanup by @vipulnsward [GH fixes #267]
* lib/cgi/core.rb: change each to each_value
 * ext/bigdecimal/lib/bigdecimal/{jacobian,math}.rb:
   remove unused variables from bigdecimal lib



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-29 00:42:32 +00:00
naruse 20219afd83 Suppress warnings
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-23 19:50:47 +00:00
mrkn bc43842252 * ext/bigdecimal/bigdecimal.c (BigDecimal_divide): Use Qnil and NIL_P
instead of (VALUE)0 as a return value.

* ext/bigdecimal/bigdecimal.c (BigDecimal_div): ditto.

* ext/bigdecimal/bigdecimal.c (BigDecimal_divremain): ditto.

* ext/bigdecimal/bigdecimal.c (BigDecimal_remainder): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39885 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-23 14:30:56 +00:00
mrkn e52a4a70a9 * ext/bigdecimal/bigdecimal.c: Fix style.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-22 01:38:55 +00:00
ayumin 49636da490 * ext/bigdecimal/bigdecimal.c: fixed typo. same as r39830
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-19 19:23:15 +00:00
ayumin 6f072a36c0 * ext/bigdecimal/bigdecimal.c: fixed typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-19 19:19:46 +00:00
kazu dbec401c11 use INT2FIX(0) instead of INT2NUM(0).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-05 16:31:19 +00:00
mrkn c42cf83f26 * ext/bigdecimal/bigdecimal.gemspec: bump to 1.2.0.
[ruby-core:51777] [Bug #7761]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-19 11:50:48 +00:00
mrkn a4665e30f7 * ext/bigdecimal/bigdecimal.c (BigDecimal_to_s): use CRuby style.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-14 05:42:51 +00:00
mrkn 512b987544 * ext/bigdecimal/bigdecimal.c: use `RB_TYPE_P(x, t)` instead of
`TYPE(x) == t`.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38809 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-14 05:42:48 +00:00
mrkn dc2182aab8 * ext/bigdecimal/bigdecimal.c (BigDecimal_sub):
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
2013-01-13 06:15:37 +00:00
mrkn 1be6a498ba * ext/bigdecimal/bigdecimal.c (rmpd_power_by_big_decimal):
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
2013-01-07 14:42:52 +00:00
shugo 3a6dec0c5d * include/ruby/ruby.h (RB_UNUSED_VAR): new macro to suppress
warnings for unused variables.

* ext/bigdecimal/bigdecimal.c (ENTER): use RB_UNUSED_VAR() to
  suppress annoying warnings by -Wunused-but-set-variable in gcc 4.6.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-13 03:09:22 +00:00
mrkn 1fec21fe60 * ext/bigdecimal/bigdecimal.c (BigDecimal_new): stop checking string
taintness.  [Bug #5508] [ruby-core:40510]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-02 15:09:49 +00:00
zzak 50c859715d * ext/bigdecimal/bigdecimal.c:
Documentation for BigDecimal
  Based on a patch from Vincent Batts
  [ruby-core:49047] [Bug #7305]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-09 07:03:13 +00:00
mrkn a3e5a86596 * ext/bigdecimal/bigdecimal.c (BigDecimal_new),
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
2012-11-01 13:04:04 +00:00
mrkn 2e6b5ece95 * ext/bigdecimal/bigdecimal.c (BigDecimal_add),
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
2012-11-01 13:03:53 +00:00
usa 1d1130eea1 * ext/bigdecimal/bigdecimal.c (BigDecimal_to_f): use self's sign to
determine 0.0 and Inf's sign instead of internal double value's.
  Reported by phasis68 (Heesob Park) at [ruby-core:47381] [Bug #6955]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-31 05:34:08 +00:00
nobu d7ca01a73a bigdecimal.c: check underflow
* 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
2012-08-30 07:17:56 +00:00
nobu 13527efd59 bigdecimal.c: fix format specifier
* ext/bigdecimal/bigdecimal.c (BigMath_s_log): fix format specifier.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36633 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-05 15:40:56 +00:00
mrkn d3a349bbc3 * ext/bigdecimal/lib/bigdecimal/jacobian.rb,
ext/bigdecimal/lib/bigdecimal/newton.rb:
  fix documentation comments.
  Patch by alperakgun from github.com/shyouhei/ruby/pull/8

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-30 07:30:46 +00:00
mrkn ecb6bd90c0 * ext/bigdecimal/lib/bigdecimal/jacobian.rb (Jacobian#dfdxi):
fix jacobian to get stuck in an infinite loop when a solution is not
  found due to forget to increment nRetry counter.
  Patch by alperakgun from github.com/shyouhei/ruby/pull/8

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-30 07:26:51 +00:00
nobu af310963ab * ext/bigdecimal/bigdecimal.c (PUSH): to prevent VALUE from GC,
must not cast it to unsigned long, which may be shorter than
	  VALUE, and the result can be mere garbage.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35619 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-11 05:09:58 +00:00
nobu 9cc7e9d1e8 Revert r35616 "* ext/bigdecimal/bigdecimal.c: use RB_GC_GUARD. [ruby-dev:45627]"
RB_GC_GUARD() is only for variables on the machine stack, because it
forces a VALUE to be stored in a variable which should be referenced
from the GC, but does not add any reference path to the variable.
So it makes no sense for objects in heap.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35618 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-11 04:50:54 +00:00
mrkn c8b3528383 * ext/bigdecimal/bigdecimal.c: use RB_GC_GUARD. [ruby-dev:45627]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35616 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-10 18:44:25 +00:00
naruse 0fce0545b6 * ext/bigdecimal/bigdecimal.c (Init_bigdecimal): define IDs before
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
2012-05-07 02:03:28 +00:00
drbrain da39d32f60 * encoding.c (rb_enc_codepoint_len): Use UNREACHABLE to avoid "control
reaches end of non-void function" warnings.  [ruby-trunk - Bug #6066]
* re.c (name_to_backref_number):  ditto.
* object.c (rb_Float):  ditto.
* io.c (io_readpartial):  ditto.
* io.c (io_read_nonblock):  ditto.
* pack.c (rb_uv_to_utf8):  ditto.
* proc.c (rb_method_entry_arity):  ditto.
* vm_method.c (rb_f_notimplement):  ditto.
* struct.c (rb_struct_aset_id):  ditto.
* class.c (rb_scan_args):  ditto.
* process.c (rlimit_resource_type):  ditto.
* process.c (rlimit_resource_value):  ditto.
* process.c (p_uid_switch):  ditto.
* process.c (p_gid_switch):  ditto.
* ext/digest/digest.c (rb_digest_instance_update):  ditto.
* ext/digest/digest.c (rb_digest_instance_finish):  ditto.
* ext/digest/digest.c (rb_digest_instance_reset):  ditto.
* ext/digest/digest.c (rb_digest_instance_block_length):  ditto.
* ext/bigdecimal/bigdecimal.c (BigDecimalCmp):  ditto.
* ext/dl/handle.c (rb_dlhandle_close):  ditto.
* ext/tk/tcltklib.c (pending_exception_check0):  ditto.
* ext/tk/tcltklib.c (pending_exception_check1):  ditto.
* ext/tk/tcltklib.c (ip_cancel_eval_core):  ditto.
* ext/tk/tcltklib.c (lib_get_reltype_name):  ditto.
* ext/tk/tcltklib.c (create_dummy_encoding_for_tk_core):  ditto.
* ext/tk/tkutil/tkutil.c (tk_hash_kv):  ditto.
* ext/openssl/ossl_ssl.c (ossl_ssl_session_reused):  ditto.
* ext/openssl/ossl_pkey_ec.c (ossl_ec_key_dsa_verify_asn1):  ditto.
* ext/openssl/ossl_pkey_ec.c (ossl_ec_point_is_at_infinit):  ditto.
* ext/openssl/ossl_pkey_ec.c (ossl_ec_point_is_on_curve):  ditto.
* ext/fiddle/conversions.c (generic_to_value):  ditto.
* ext/socket/raddrinfo.c (rsock_io_socket_addrinfo):  ditto.
* ext/socket/socket.c (sock_s_getnameinfo):  ditto.
* ext/ripper/eventids2.c (ripper_token2eventid):  ditto.
* cont.c (return_fiber):  ditto.
* dmydln.c (dln_load):  ditto.
* vm_insnhelper.c (vm_search_normal_superclass):  ditto.
* bignum.c (big_fdiv):  ditto.
* marshal.c (r_symlink):  ditto.
* marshal.c (r_symbol):  ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-13 23:45:37 +00:00
naruse 697b53d8a9 * ext/bigdecimal/lib/bigdecimal/math.rb: remove description about
BigMath#log. patched by Sho Hashimoto [ruby-dev:45307] [Bug #6112]

* string.c (str_byteslice): fix typo.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34899 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-05 02:53:36 +00:00
nobu f5482e4c38 * ext/bigdecimal/bigdecimal.c (GetVpValueWithPrec): since methods
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
2012-02-27 08:03:24 +00:00
kazu 0212af1733 * ext/bigdecimal/bigdecimal.h: add satisfy cc-mode comment.
* util.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34104 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-22 21:06:19 +00:00
nagachika c9a9036d0b ChangeLog: revert r34093. sorry, these are necessary for ruby-mode.el
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-21 15:50:15 +00:00
nagachika 4af11279c6 * ext/bigdecimal/bigdecimal.c (VpMult, VpCtoV, VpSqrt): remove assined
but unused variables.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-21 15:42:41 +00:00
nagachika af845f3528 * ext/bigdecimal/bigdecimal.h: remove unused lines.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34093 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-21 15:37:07 +00:00
nobu f9a4d5717c * ext/bigdecimal/bigdecimal.c (BigDecimal_s_allocate): follow
Allocation Framework.  [Bug #5775]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34089 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-21 03:35:27 +00:00
kazu 327ea26b59 * ext/bigdecimal/README: Update redmine.ruby-lang.org to bugs.ruby-lang.org
* ext/socket/ancdata.c: ditto
* test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb: ditto
* test/syck/test_yaml.rb: ditto
* doc/ChangeLog-1.9.3: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-20 16:09:17 +00:00
nobu 9c00c1234d * ext/bigdecimal/bigdecimal.c (Init_bigdecimal): does not follow
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-18 05:34:34 +00:00
drbrain 3a5daefe1f * ext/bigdecimal/bigdecimal.c: Document +@, -@, hash, INFINITY, Nan.
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-07 01:58:59 +00:00
nobu d0b2816d02 * ext/bigdecimal/bigdecimal.c (VpAllocReal): reduce extra frac.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-02 06:48:10 +00:00
nobu a394c59be3 * ext/bigdecimal/bigdecimal.h (Real): suppress false warning from
clang.  [ruby-core:41418] [Bug#5693]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33915 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-01 05:43:22 +00:00
nobu 413f24d3b0 * whitespace cleanup.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33634 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-04 07:19:23 +00:00
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
mrkn d86da0fcf1 * ext/bigdecimal/extconf.rb, ext/bigdecimal/bigdecimal.h (labs, llabs): 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-14 15:22:43 +00:00
mrkn f2c65c0a33 * ext/bigdecimal/bigdecimal.c: don't use // comment.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28960 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-11 02:02:16 +00:00
mrkn 7694956ef7 * ext/bigdecimal/bigdecimal.c, ext/bigdecimal/bigdecimal.h, 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 06:25:27 +00:00
mrkn 678af70ce8 * ext/bigdecimal/bigdecimal.h, ext/bigdecimal/bigdecimal.c: add extern declaration of rb_cBigDecimal.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28946 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-10 06:25:23 +00:00
nobu c53664c84d .cvsignore: have not been used already. [Bug #3468]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-07 05:43:21 +00:00
nobu aa1141e167 * ext/bigdecimal/bigdecimal.c (BigDecimal_hash): fix type warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28838 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-02 22:34:44 +00:00