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

325 Коммитов

Автор SHA1 Сообщение Дата
mame 6ad3f61663 * bignum.c (big_op): comparison of bignum and infinity has returned 1
or -1, but it must return boolean.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28815 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-01 01:12:54 +00:00
nobu 45f6fbf339 * removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-29 18:51:39 +00:00
marcandre 7729de4d91 * array.c: Documentation: change => in call-seq to ->.
Harmonize "#=>" in examples. [ruby-core:30206]

* bignum.c: ditto

* class.c: ditto

* compar.c: ditto

* cont.c: ditto

* dir.c: ditto

* encoding.c: ditto

* enum.c: ditto

* enumerator.c: ditto

* error.c: ditto

* eval.c: ditto

* file.c: ditto

* gc.c: ditto

* io.c: ditto

* load.c: ditto

* marshal.c: ditto

* math.c: ditto

* numeric.c: ditto

* object.c: ditto

* pack.c: ditto

* proc.c: ditto

* process.c: ditto

* random.c: ditto

* range.c: ditto

* re.c: ditto

* ruby.c: ditto

* signal.c: ditto

* sprintf.c: ditto

* string.c: ditto

* struct.c: ditto

* thread.c: ditto

* time.c: ditto

* transcode.c: ditto

* variable.c: ditto

* vm_eval.c: ditto

* vm_method.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-17 21:07:33 +00:00
nobu 9372cdb80a * bignum.c (bigmul1_karatsuba): suppress a warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-25 15:08:44 +00:00
mame 52998fa591 * bignum.c (bigmul1_karatsuba): fix calculation order to prevent
underflow.  [ruby-core:29088]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-20 15:31:46 +00:00
muraken e4d8dc5c46 * bignum.c, node.h, strftime.c, enc/trans/utf8_mac.trans: added explicit casts for supplessing warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-25 03:08:28 +00:00
akr 70d72bf807 * bignum.c (rb_big_pack): use DIGSPERLONG and BITSPERDIG.
(rb_big_unpack): use DIGSPERLONG.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26845 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-07 14:15:24 +00:00
akr ef7d0431a0 add comment.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-04 14:20:49 +00:00
akr a971778b39 * pack.c: check assuption on QUAD_SIZE and SIZEOF_LONG.
* bignum.c: check assuption on SIZEOF_LONG and SIZEOF_BDIGITS.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26773 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-27 06:56:46 +00:00
akr 8c9024763f * pack.c: fix q and Q for big endian environments which have no
8 bytes integer type.
  (pack_pack): use rb_big_pack.
  (pack_unpack): use rb_big_unpack.

* include/ruby/intern.h (rb_big_pack): declared.
  (rb_big_unpack): ditto.

* bignum.c (rb_big_pack): new function.
  (rb_big_unpack): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26771 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-26 18:51:02 +00:00
akr 069d271eb5 * bignum.c: fix rb_quad_pack and rb_quad_unpack for environments
which don't have 8bytes integer type.  This still depends on little
  endian.
  (rb_quad_pack): use quad_buf_complement.  don't raise for large
  values.
  (rb_quad_unpack): use quad_buf_complement.
  (quad_buf_complement): new function extracted frm rb_quad_pack.
  add one after bitwise negation.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-26 12:41:02 +00:00
akr 07298aba22 * pack.c (QUAD_SIZE): it should be always 8.
* bignum.c (rb_quad_pack): use LONG_LONG version only if
  SIZEOF_LONG_LONG == QUAD_SIZE.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-26 11:09:29 +00:00
naruse 1c4fe5395d * bignum.c (big_op): remove unused variables.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-05 00:28:22 +00:00
mame f574df443a * bignum.c (big_gt, big_ge, big_lt, big_ge): added Bignum#>, >=, < and
<= to allow to compare with BigDecimal.  [ruby-dev:40167]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26574 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-04 15:36:29 +00:00
matz d1499525d5 * ext/bigdecimal/bigdecimal.c (BigDecimal_to_i): update RDoc to
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-28 16:34:11 +00:00
mame 7f418222b1 * bignum.c (bigsub_int): remove nonsense loop.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-18 16:55:15 +00:00
naruse 7ed0640ffb Add Float::INFINITY and Float::NAN.
* numeric.c (Init_Numeric): Add Float::INFINITY and Float::NAN.
  [ruby-dev:1657] [ruby-dev:4760] [ruby-list:7023] [ruby-list:46690]
  [ruby-core:26632] [ruby-talk:41352] [ruby-talk:203333]

* include/ruby/defines.h (INFINITY): defined.

* include/ruby/defines.h (NAN): defined.

* include/ruby/util.h (ruby_div0): removed.

* numeric.c (fix_pow): use INFINITY and NAN instead of ruby_div0(1.0).

* marshal.c (r_object0): ditto.

* bignum.c (big_fdiv): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-29 07:05:39 +00:00
nobu 4d786d21e3 * removed spaces just before tabs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-26 05:25:08 +00:00
marcandre 705c567194 * string.c: rdoc for <=>, casecmp
* bignum.c: rdoc for <=>

* file.c: ditto

* time.c: ditto

* compar.c: rdoc

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-28 04:50:09 +00:00
mame 8c01a3765e * bignum.c (big_split): fix off-by-one error. [ruby-dev:39501]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25383 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-17 08:31:07 +00:00
akr 5d372d0c40 fix rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25314 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-12 17:49:15 +00:00
nobu b516046d8e * bignum.c (bigmul1_single): suppress a warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-13 04:15:06 +00:00
nobu 31b7ae00c0 * include/ruby/st.h (st_hash_func): use st_index_t.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-08 13:10:04 +00:00
nobu 6da90f39c6 * bignum.c (rb_big_idiv): added rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24749 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-04 08:06:12 +00:00
nobu e825a2c030 * bignum.c (rb_big_div, rb_big_idiv): fixed indent.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-04 05:40:52 +00:00
akr fc6be8cdeb * bignum.c (bigmul1_single): new function specialized respect to
multiply two single digit bignums.
  (bigmul0): use bigmul1_single.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24708 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-30 00:46:32 +00:00
nobu 8e6ea3712b * bignum.c (rb_big_clone, bigmul1_normal, bigdivrem): trivial
optimization.

* bignum.c (big2dbl): truncates zero digits to get rid of possible
  underflow.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-25 08:38:28 +00:00
tadf 02a7cbec82 * numeric.c (flo_pow,fix_pow): may return complex number.
* bignum.c (rb_big_pow): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-16 23:03:45 +00:00
ko1 8e8e34319b * insns.def, vm.c, vm_insnhelper.c, vm_insnhelper.h: check
definition of (classes)#=== for case/when optimization.
  Fix Bug #1376 [ruby-core:23190].
* string.c (Init_String), bignum.c (Init_Bignum),
  numeric.c (Init_Numeric): define String#===, Symbol#===,
  Bignum#===, Fixnum#===, Float#=== as same as (classes)#==.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-12 05:55:06 +00:00
mame 20d6525a6f * bignum.c (rb_big_cmp, bigsub, big_real_len, bigmul1_normal,
bigmul1_balance, big_split): remove BDIGITS() inside of the loops.
  same as r24444.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24481 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-09 05:55:00 +00:00
matz 4307340208 * bignum.c (bigzero_p): removing BDIGITS() inside of the
loop. inspired by Hitohiro Kanai's blog entry
  <http://d.hatena.ne.jp/CanI/20090807/1249657492>.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-08 02:47:02 +00:00
nobu e07cb859cc * suppressed shorten-64-to-32 warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-18 08:05:32 +00:00
nobu 5e65d8f433 * bignum.c (rb_big_new, rb_bigzero_p), range.c (rb_range_values):
added for random.c.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-16 06:52:29 +00:00
nobu 44a1d99635 * bignum.c (big_lshift, big_rshift): return Bignum always without
normalization.  [ruby-dev:38679]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-18 23:14:08 +00:00
matz 7fc9c4a4a0 * numeric.c (flo_cmp): Infinity is greater than any bignum
number.  [ruby-dev:38672]

* bignum.c (rb_big_cmp): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-17 17:05:31 +00:00
tadf b6849b2502 * bignum.c (rb_big_fdiv): checks whether the given second argument
can be converted to float properly.

	* numeric.c (fix_fdiv): calls rb_big_fdiv when the given second
	  argument is a bignum.

	* rational.c (nurat_fdiv): should calculate Float(x/y), not
	  Float(x)/Float(y).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23726 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-17 12:55:16 +00:00
tadf 7a71dff0bf avoid signbit() and adjust indentation.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23698 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-15 22:58:46 +00:00
tadf 04388f9f9d * bignum.c (rb_big2db): (-Float::MAX.to_i*2).to_f should return
-HUGE_VAL (-Infinity).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-15 13:39:18 +00:00
matz 80ad1473cf * bignum.c (bigand_int): new function to calculate bignum and
fixnum without allocating internal bignum.

* bignum.c (bigor_int): ditto.

* bignum.c (bigxor_int): ditto.

* bignum.c (bigand_int): even less object allocation.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-27 16:16:57 +00:00
nobu 8e86bd59c0 * common.mk (bignum.o, numeric.o): depend on util.h.
* bignum.c, marshal.c: fixed types.

* numeric.c (infinite_value): use ruby_div0.

* include/ruby/util.h (ruby_div0): moved from marshal.c.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-26 04:58:15 +00:00
matz 0acedf8066 * bignum.c (bignew_1): inline memory allocation.
* bignum.c (bigtrunc): call rb_big_resize() only when needed.

* bignum.c (bigfixize): declare inline.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23574 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-26 02:19:33 +00:00
matz dd54da6ede * bignum.c (bigsub_int): subtraction without making internal
bignum values.

* bignum.c (bigadd_int): ditto for addition.

* bignum.c (bigtrunc): declare inline.

* bignum.c (rb_quad_pack): fix condition.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-20 17:53:36 +00:00
akr 5f64ea6c60 * bignum.c (rb_cmpint): FIX2INT may fail on LP64 platforms.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-26 16:20:58 +00:00
nobu 96c31ac787 * bignum.c (bigfixize): zero length Bignum is 0.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-13 00:30:15 +00:00
nobu d1abc53721 * array.c, bignum.c, dln.c, error.c, gc.c, io.c, marshal.c,
numeric.c, pack.c, strftime.c, string.c, thread.c, transcode.c,
  transcode_data.h, util.c, variable.c, vm_dump.c,
  include/ruby/encoding.h, missing/crypt.c, missing/vsnprintf.c:
  suppress VC type warnings.  [ruby-core:22726]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-12 09:16:15 +00:00
nobu 2e54fe9d4d * array.c, bignum.c, gc.c, numeric.c, string.c, util.c, insns.def,
missing/crypt.c, missing/vsnprintf.c, : suppress warnings.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-10 05:43:14 +00:00
nobu 12d2c8ba41 stripped trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-22 14:23:33 +00:00
tadf c7e236efc1 * bignum.c (rb_cstr_to_inum): changed an error message.
* complex.c (string_to_c_strict): ditto.

	* rational.c (string_to_r_strict): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-29 14:26:16 +00:00
mame 43a9e10a23 * bignum.c (bigmul1_karatsuba): remove temporal bignum.
* bignum.c (bigsqr): call bigmul0(x, x) because it is faster than the
  original bigsqr at this point.

* bignum.c (rb_big_pow): a value returned from bigsqr is already
  truncated.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-14 13:39:33 +00:00
mame 26fc24fb0b * bignum.c (bigmul1_karatsuba): fix comment and refactoring.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-14 12:15:07 +00:00
mame bba7733b20 * bignum.c (bigmul1_balance, bigmul1_karatsuba): remove all
rb_gc_force_recycle which causes memory leak.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-14 05:55:54 +00:00
mame 19f45f853c * bignum.c (rb_big_mul): faster multiplication by Karatsuba method and
twice faster square than normal multiplication.

* random.c (rb_rand_internal): used by Bignum#*.

* test/ruby/test_bignum.rb: add some tests for above.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-14 03:59:02 +00:00
tadf f2cb79ffee * complex.c: uses f_(in)?exact_p macro.
* rational.c: ditto.

	* bignum.c (rb_big_pow): bignum**bignum - should calculate without
	  rational.

	* lib/complex.rb: should override Math module at most once.

	* lib/mathn.rb: requires 'cmath' directly.

-この行以下は無視されます --

M    complex.c
M    ChangeLog
M    lib/mathn.rb
M    lib/complex.rb
M    bignum.c
M    rational.c


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-19 13:55:52 +00:00
matz bc9c077400 * bignum.c (big2str_karatsuba): free internal buffer eagerly.
a patch from TOYOFUKU Chikanobu <nobu_toyofuku at nifty.com>
  in [ruby-dev:36217].

* bignum.c (rb_big2str0): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19414 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-18 11:21:34 +00:00
ko1 69029b90fe * gc.c, include/ruby/ruby.h: rename rb_register_mark_object()
to rb_gc_register_mark_object().
* eval.c, vm.c: initialize vm->mark_object_ary at
  Init_top_self().
* bignum.c, complex.c, encoding.c, ext/win32ole/win32ole.c,
  io.c, load.c, marshal.c, rational.c, ruby.c, vm.c:
  use rb_gc_register_mark_object() instead of
  rb_global_variable() or rb_gc_register_address().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19365 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-15 14:59:14 +00:00
matz 63471c7c32 * bignum.c (bigdivrem): adjust length for division and remainder.
a patch from TOYOFUKU Chikanobu <nobu_toyofuku at nifty.com> in 
  [ruby-dev:36231].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19293 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-11 06:30:56 +00:00
matz ba75344338 * bignum.c (big2str_karatsuba): remove unnecessary fixnum code. a
patch from TOYOFUKU Chikanobu <nobu_toyofuku at nifty.com> in
  [ruby-dev:36217].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-11 02:40:52 +00:00
matz 7a04666b3c * bignum.c (bigdivrem1): optimization by skipping zeros at the
tail of digits.  a patch from TOYOFUKU Chikanobu
  <nobu_toyofuku at nifty.com> in [ruby-dev:36169].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19171 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-05 23:25:13 +00:00
matz 31b6ea65bb * include/ruby/ruby.h (DBL2NUM): renamed from DOUBLE2NUM.
a patch from Tadashi Saito <shiba at mail2.accsnet.ne.jp>
  in [ruby-dev:36102].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-05 18:24:21 +00:00
matz 66529e382f * bignum.c (bigdivmod): remove redundant code. a patch from
TOYOFUKU Chikanobu <nobu_toyofuku at nifty.com> in [ruby-dev:36044].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-29 16:56:44 +00:00
tadf a5bdf63afd * bignum.c: added an alias (#magnitude).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-29 14:50:43 +00:00
ko1 72ba13aa8e * array.c, bignum.c, cont.c, dir.c, dln.c, encoding.c, enumerator.c,
enumerator.c (enumerator_allocate), eval_jump.c, file.c, hash.c,
  io.c, load.c, pack.c, proc.c, random.c, re.c, ruby.c, st.c,
  string.c, thread.c, thread_pthread.c, time.c, util.c, variable.c,
  vm.c, gc.c:
  allocated memory objects by xmalloc (ruby_xmalloc) should be
  freed by xfree (ruby_xfree).
* ext/curses/curses.c, ext/dbm/dbm.c, ext/digest/digest.c,
  ext/gdbm/gdbm.c, ext/json/ext/parser/parser.c,
  ext/json/ext/parser/unicode.c, ext/openssl/ossl_cipher.c,
  ext/openssl/ossl_hmac.c, ext/openssl/ossl_pkey_ec.c,
  ext/sdbm/init.c, ext/strscan/strscan.c, ext/zlib/zlib.c:
  ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-08 10:01:40 +00:00
akr 6c1e664bb1 * bignum.c (bigzero_p): check from MSB to LSB. [ruby-dev:34649]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16384 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-12 04:44:13 +00:00
matz 65b55c26a1 * bignum.c (rb_big_and): bit-wise operation should not take float
values.  [ruby-dev:34612]

* bignum.c (rb_big_or): ditto.

* bignum.c (rb_big_xor): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-08 09:18:47 +00:00
matz fa16110326 * bignum.c (rb_big_fdiv): flo.fdiv(NaN) should result NaN.
* numeric.c (num_quo): renamed and moved from bignum.c.
  [ruby-dev:34582]

* bignum.c (rb_big_fdiv): update RDoc description

* rational.c (nurat_s_new_m): small refactoring.

* bignum.c (rb_big2dbl): no need for forceful warning when
  converting to float.  overflow is a nature of float values.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16308 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-07 04:14:57 +00:00
nobu b5f2df6b9e * bignum.c (rb_big_divide), numeric.c (fix_divide): check for result
domain.  [ruby-dev:34559]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16258 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-01 15:00:01 +00:00
nobu de0561684c * bignum.c (rb_big_divide): return an integer for idiv.
[ruby-dev:34553]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-01 14:20:15 +00:00
tadf 4e046758f5 * numeric.c: cancelled recent changes (except to remove rdiv).
* bignum.c: ditto.

	* bignum.c: added rb_big_idiv.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-07 13:52:26 +00:00
matz bdc00ba604 * bignum.c (rb_cmpint): moved from compar.c, to check bignum
zero.

* range.c (range_step): add step for each iteration if begin and
  end are numeric.  [ruby-core:15990]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-06 17:11:50 +00:00
matz 228f30be3a * bignum.c (Init_Bignum): rdiv method removed. [ruby-dev:34242]
* complex.c (nucomp_quo): ditto.

* numeric.c (num_rdiv): ditto.

* rational.c (nurat_div): ditto.

* complex.c (nucomp_fdiv): fdiv implementation restored.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-03 16:01:16 +00:00
nobu e31a69562e * bignum.c (big2dbl): more precise conversion at edge cases.
[ruby-dev:34195]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15881 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-01 07:40:23 +00:00
matz 88a4961cb2 * numeric.c (num_quo): should convert its operand to Rational.
* rational.c (string_to_r_strict): should raise TypeError.

* bignum.c (Init_Bignum): should not redefine Bignum#div.
  Numeric#div will do.  [ruby-dev:34066]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-31 10:14:42 +00:00
nobu 2188bbced3 * bignum.c (rb_cstr_to_inum): treat successive underscores as
nondigit.  [ruby-dev:34089]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15799 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-19 05:36:43 +00:00
tadf 6125552c27 both complex and rational are now builtin classes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-16 00:23:43 +00:00
akr 861219ce4a fix doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-09 01:04:46 +00:00
mame fddbc2738f * bignum.c: fix indent.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-07 12:28:57 +00:00
mame a6267179ee * bignum.c (power_cache_init, power_cache_get_power0, Init_Bignum):
delayed initializing power cache per base.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-07 12:14:17 +00:00
matz 39787ea14d * numeric.c (fix_to_s): avoid rb_scan_args() when no argument
given. 
* bignum.c (rb_big_to_s): ditto.
* enum.c (enum_first): ditto.
* eval_jump.c (rb_f_catch): ditto.
* io.c (rb_obj_display): ditto.
* class.c (rb_obj_singleton_methods): ditto.
* object.c (rb_class_initialize): ditto.
* random.c (rb_f_srand): ditto.
* range.c (range_step): ditto.
* re.c (rb_reg_s_last_match): ditto.
* string.c (rb_str_to_i): ditto.
* string.c (rb_str_each_line): ditto.
* string.c (rb_str_chomp_bang): ditto.
* string.c (rb_str_sum): ditto.

* string.c (str_modifiable): declare inline.
* string.c (str_independent): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-05 05:22:17 +00:00
nobu 4a65cba488 * bignum.c (big2str_find_n1): check integer overflow.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-29 17:35:11 +00:00
usa 07de01ca3b * bignum.c (big2str_karatsuba): initialize cache if not initialized.
* bignum.c (Init_Bignum): delayed initializing cache.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-25 06:34:38 +00:00
nobu bc2fb51c5e * bignum.c (BIGZEROP): fix for longer Bignum zeros. [ruby-Bugs-17454]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-22 10:50:21 +00:00
matz f3ac3dc79c * numeric.c (rb_num_coerce_bin): add ID argument to specify
caller's method name.  [ruby-dev:33663]

* numeric.c (rb_num_coerce_cmp): ditto.

* numeric.c (rb_num_coerce_relop): ditto.

* ext/bigdecimal/bigdecimal.c (DoSomeOne): add function name argument.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-12 02:46:21 +00:00
tadf 8429f2be9f adjustment
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-30 11:20:03 +00:00
tadf fb997983a2 * bignum.c (rb_cstr_to_inum): '0_2' is a valid representatin.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-30 03:07:37 +00:00
mame 67212c5ba4 * bignum.c: move object allocation out of blocking_region.
[ruby-dev:33139]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-29 12:58:24 +00:00
usa a9e2312806 * bignum.c (rb_big2str0): should be US-ASCII.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15298 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-28 15:12:43 +00:00
naruse 42dcda08ae * string.c (rb_str_usascii_new{,2}: defined.
(rb_str_new): set US-ASCII and ENC_CODERANGE_7BIT when empty
  string.

* encoding.c (rb_usascii_encoding, rb_usascii_encindex): defined.
  (rb_enc_inspect, enc_name, rb_locale_charmap, rb_enc_name_list_i):
  use rb_str_ascii_new.

* array.c (recursive_join, inspect_ary): ditto.

* object.c (nil_to_s, nil_inspect, true_to_s, false_to_s,
  rb_mod_to_s): ditto.

* hash.c (inspect_hash, rb_hash_inspect, rb_f_getenv, env_fetch,
  env_clear, env_to_s, env_inspect): ditto.

* numeric.c (flo_to_s, int_chr, rb_fix2str): ditto.

* bignum.c (rb_big2str): ditto.

* file.c (rb_file_ftype, rb_file_s_dirname, rb_file_s_extname,
  file_inspect_join, Init_file): ditto.

* test/ruby/test_ruby_m17n.rb: add checks for encoding of string.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-25 16:40:02 +00:00
mame c06bb92b86 * bignum.c (big_shift): fix a bug that caused infinite loop when
left shifting.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-21 15:33:32 +00:00
akr 6cdef2dc7e * $Date$ keyword removed to avoid inclusion of locale dependent
string.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-06 15:49:38 +00:00
akr 9d52fda376 * bignum.c (conv_digit): use ISDIGIT, ISLOWER and ISUPPER.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14855 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-02 17:48:20 +00:00
akr 99fc557fa5 don't need to include ruby/util.h.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14853 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-02 07:09:14 +00:00
akr 0352d32f05 * util.c (ruby_strtoul): locale independent strtoul is implemented to
avoid "i".to_i(36) cause 0 under tr_TR locale.
  This is newly implemented, not a copy of missing/strtoul.c.

* include/ruby/ruby.h (ruby_strtoul): declared.
  (STRTOUL): defined to use ruby_strtoul.

* bignum.c, pack.c, ext/socket/socket.c: use STRTOUL.

* configure.in (strtoul): don't check.

* missing/strtoul.c: removed.

* include/ruby/missing.h (strtoul): removed.

* common.mk (strtoul.o): removed.

* LEGAL (missing/strtoul.c): removed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14850 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-02 06:24:27 +00:00
akr 5088b14db7 fix typos.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-31 06:43:32 +00:00
usa e3215a7342 * pack.c (pack_pack): use NUM2LONG instead of NUM2INT.
* numeric.c (fix_lshift, fix_aref): use SIZEOF_LONG instead of
	  SIZEOF_VALUE.

	* bignum.c (big2ulong, rb_big_aref): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-24 18:12:24 +00:00
matz 256ddf48c2 * bignum.c (rb_big_mul0): remove unused variable.
* bignum.c (bigdivrem): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 11:22:08 +00:00
akr 4cf437519f * regerror.c, string.c, io.c, lib/getoptlong.rb, lib/net/imap.rb,
compile.c, sprintf.c, parse.y, ext/win32ole/win32ole.c,
  ext/tk/sample/demos-en/entry3.rb, ext/tk/lib/tcltk.rb,
  ext/openssl/ossl_bn.c, numeric.c, vm.c,
  benchmark/bm_so_meteor_contest.rb, bignum.c, ruby.c: don't "illegal"
  for non law violation context.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 02:31:11 +00:00
matz 9a82a62937 * bignum.c (big2str_orig): access beyond memory region cause crash
on interrupt.  a patch from Yusuke ENDOH <mame AT tsg.ne.jp> in 
  [ruby-dev:32651].  [ruby-dev:32641]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-20 00:43:39 +00:00
usa 4b8ebed41c * bignum.c (bigmul1): C99ism.
* bignum.c (bigdivrem1): need dummy return value.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14331 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-19 11:40:52 +00:00
matz 8acb0fbd4d * bignum.c (rb_big_mul0): blocking check for bigger numbers.
a patch from Yusuke ENDOH <mame AT tsg.ne.jp> in [ruby-dev:32632].

* bignum.c (bigdivrem): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-19 10:13:03 +00:00
nobu 198c092004 * bignum.c (rb_cstr_to_inum): an underscore succeeding after octal
prefix is allowed.  [ruby-core:14139]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14311 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-19 01:52:31 +00:00