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

301 Коммитов

Автор SHA1 Сообщение Дата
marcandre 4afa9ed041 * array.c: Harmonize documentation, in particular regarding:
- methods returning enumerators
    - array methods and argument naming (array -> ary, an_array -> new_ary)
    - minor improvements, typo fixed and styling issues

  Other documentation errors fixed:
    - return value was self instead of a new array (or vice-versa) for
      Array#{pop,shift,permutation,repeated_permutation,keep_if}
    - Array#rindex was missing the form with a block.

* dir.c: ditto.

* enum.c: ditto. Modified Enumerable#reverse_each' documentation to clarify
  that #each will be finish before any element is yielded.

* error.c: ditto.

* gc.c: ditto.

* hash.c: ditto.

* io.c: ditto. IO#{codepoints,each_codepoint} fixed as per [ruby-core:23948]

* numeric.c: ditto.

* range.c: ditto.

* string.c: ditto.

* struct.c: ditto.

* vm_eval.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-13 05:49:55 +00:00
nobu cf32125cff * marshal.c (w_float): use minimal representation.
* numeric.c (ruby_dbl2cstr): split from rb_float_new.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27774 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-13 04:30:07 +00:00
nobu d80a859d98 * numeric.c (flo_to_s): fixed broken output including nuls.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-12 07:43:14 +00:00
nobu d2a68945e6 * numeric.c (flo_to_s): exponent needs 2 digits.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-12 07:25:48 +00:00
nobu 16ea63ad69 * numeric.c (flo_to_s): fill lower zeros.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-12 07:02:45 +00:00
nobu 07b314f07b * numeric.c (flo_to_s): make minimum string representation.
[ruby-core:30145]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27745 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-12 01:57:08 +00:00
marcandre 1dee5e34a3 * error.c: RDoc for subclasses of Exception. [ruby-core:28394]
* cont.c: ditto

* enumerator.c: ditto

* io.c: ditto

* math.c: ditto

* numeric.c: ditto

* proc.c: ditto

* re.c: ditto

* thread.c: ditto

* transcode.c: ditto. Thanks to Run Paint for some of the documentation.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-08 04:50:09 +00:00
marcandre 478c3e080b * eval.c (make_exception, rb_obj_extend): Fix error messages in case of wrong
number of arguments

* file.c (rb_f_test, rb_file_s_umask): ditto

* numeric.c (int_chr, num_step): ditto

* process.c (rb_f_sleep): ditto

* re.c (rb_reg_initialize_m): ditto

* signal.c (rb_f_kill, sig_trap): ditto

* string.c (rb_str_aref_m, rb_str_aset_m, rb_str_count, rb_str_delete_bang,
  rb_str_slice_bang, rb_str_sub_bang, str_gsub): ditto

* proc.c (curry): rdoc fix

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-30 02:40:57 +00:00
usa 34f182f7b2 * numeric.c (fix_mul): the width of fixnum is same as long's on all
platforms.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27555 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-29 18:39:02 +00:00
akr 36ff32040e fix rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-11 13:59:34 +00:00
akr 1ad8521d44 update rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-11 13:30:55 +00:00
matz b8acb1cc2d * numeric.c (flo_minus): RDoc update. a patch from red stun
in [ruby-core:27951]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-01 08:09:54 +00:00
nobu 41d8e49dc5 * numeric.c (flo_hash, int_chr): fixed type.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26325 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-14 04:07:00 +00:00
naruse 9db87ea5b9 * include/ruby/defines.h (INFINITY): this is float.
* include/ruby/defines.h (NAN): ditto.

* numericc.c (rb_infinity): change content as float.

* numericc.c (rb_nan): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-30 10:44:02 +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
usa dd00d45244 * numeric.c (flo_eq): supress a warning on VC++ for x64.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26050 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-08 14:41:17 +00:00
akr b9e0294eda fix typos.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-03 17:46:28 +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 ef2c92ddf0 * numeric.c (flo_quo, int_round): added rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24762 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-05 06:41:40 +00:00
nobu 0cf0b0eed4 * numeric.c (round): added declaration. [ruby-dev:39222]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-04 11:40:58 +00:00
nobu 84255e0485 * vm_method.c (rb_remove_method_id): exported.
* numeric.c (num_sadded): fix for non-ascii method name.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-27 09:31:11 +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
matz 9166dd9ec7 * numeric.c (num_imaginary): num#i to return imaginary counterpart
of the given numeric.

* complex.c (Init_Complex): undef #i for complex numbers.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24561 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-16 22:28:48 +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
nobu 8dfd78fc1c * numeric.c (num_divmod): fixed rdoc. [ruby-core:24862]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-11 12:42:53 +00:00
matz 45cd729f17 * numeric.c (flo_hash): normalize -0.0 to 0.0. [ruby-core:24577]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24361 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-03 05:15:54 +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
tadf fff1183ffe * numeric.c (fix_divide): added an entry to rational.
* rational.c (rb_rational_reciprocal): added.

	* complex.c (f_reciprocal): added.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-12 11:46:40 +00:00
matz a82c5ee48b * numeric.c (dbl2ival): should raise FloatDomainError on Infinity
and NaN as 1.8 does.  [ruby-dev:38726]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23953 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-04 00:46:14 +00:00
tadf 426afe1e67 trivial changes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23878 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-28 00:22:41 +00:00
tadf b2fb759624 * complex.c: revised rdoc.
* rational.c: ditto.

	* numeric.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-27 07:46:57 +00:00
matz 8a5ffe48e5 * numeric.c (int_chr): use default_internal encoding as default
destination encoding if set.  [ruby-dev:38717]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23864 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-26 18:18:12 +00:00
tadf d82ed7e2c6 * numeric.c (num_div): don't use num_floor which is actually
flo_floor.

	* numeric.c (num_modulo): don't call '%'.

	* numeric.c (num_divmod): use num_modulo.

	* numeric.c: defined '%'.

	* rational.c (nurat_idiv,nurat_mod,nurat_divmod,nurat_rem): removed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-20 12:37:13 +00:00
tadf a05fd849a1 * complex.c: edited rdoc.
* numeric.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-20 11:29:21 +00:00
tadf 40d6a7527e * complex.c: edited rdoc.
* rational.c: ditto.

	* numeric.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-19 23:57:34 +00:00
tadf ab7baebb6d * complex.c: edited rdoc.
* rational.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23753 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-19 21:57:51 +00:00
tadf d11b549104 * numeric.c: edited rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-19 14:44:03 +00:00
tadf f86ad72d2a due to conflict
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-19 13:37:04 +00:00
matz cdba56b38a * numeric.c (flo_cmp): should always return nil for NaN.
* numeric.c (flo_cmp): handle infinite value specially using
  infinite? method internally.  [ruby-dev:38681]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-19 08:19:14 +00:00
tadf 5134783cde * numeric.c (*_numerator,*_denominator): moved to rational.c.
* rational.c (*_numerator,*_denominator): moved from numeric.c.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-19 00:31:08 +00:00
tadf 1fda5e1a3f * numeric.c ( num_numerator, num_denominator): use
to_r [ruby-core:23910].



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-18 11:33:52 +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
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
nobu 060f433f48 * include/ruby/ruby.h (rb_long2int, RARRAY_LENINT): check long to
cast to int.  [ruby-dev:38508]

* struct.c, vm_eval.c, vm_insnhelper.c: use RARRAY_LENINT.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23503 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-20 16:43:41 +00:00
nobu 8ebd0d4320 * numeric.c (flo_to_s): reduce fragments if no precision lost.
c.f. [ruby-core:23075]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-06 16:08:23 +00:00
nobu a3a88c6bcd * file.c (sys_fail2, rb_file_s_readlink, BUFCHECK, rmext),
(rb_file_s_basename): get rid of overflow.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-06 07:38:52 +00:00
nobu 1b71f8a53b * numeric.c (int_chr): checsk overflow.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-06 06:11:57 +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 080525aa68 * marshal.c (div0), numeric.c (infinite_value): new functions to
get rid of VC divion by 0 warnings.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-12 09:09:15 +00:00