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

324 Коммитов

Автор SHA1 Сообщение Дата
usa 91d2ee737d * numeric.c (Init_Numeric): fixed a potential bug when using bccwin32
ruby with Microsoft's dll, though we already gave up of supporting
  bccwin32. [ruby-core:33503]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-01 13:05:17 +00:00
naruse ded94d1c8c * numeric.c (ruby_float_step): fix Numeric#step with infinity unit
doesn't works well. [ruby-core:32779]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29490 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-13 19:17:49 +00:00
nobu 9d0c732f0d * numeric.c (check_uint): get rid of overflow on LLP64 platforms.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-13 13:53:22 +00:00
naruse 74dcda0d41 * numeric.c (int_chr): raise error when the value is negative.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29483 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-13 12:13:53 +00:00
naruse e79fbf3dfe * numeric.c (rb_num_to_uint): fix 32bit logic.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29481 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-13 05:58:35 +00:00
naruse a01e628318 * numeric.c (rb_num_to_uint): added to check the range of arguments.
Mainly for negative value with NUM2UINT on 32bit environment.

* string.c (rb_str_concat): use rb_num_to_uint.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-13 03:56:31 +00:00
nobu 2f0b8e2793 * numeric.c (rb_num2fix): result of rb_num2long is SIGNED_VALUE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-12 14:54:06 +00:00
naruse 2d8612e966 * numeric (check_uint): the mask must refer to VALUE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29452 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-12 08:56:00 +00:00
naruse 232257238a * numeric (check_uint): set MSB for negative value.
* numeric (rb_num2uint): return value's type of rb_num2ulong
  is VALUE.

* numeric (int_chr): variable i can't be negative.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29451 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-12 08:50:30 +00:00
naruse e960fffda1 * numeric.c (rb_enc_uint_chr): split from int_chr.
* numeric.c (int_chr): use rb_enc_uint_chr.

* include/ruby/encoding.h (rb_enc_uint_chr): added.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29446 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-12 06:18:08 +00:00
naruse 6913b2734a * numeric.c (int_chr): a codepoint of Ruby M17N must be 32bit
unsigned int; GB18030 uses MSB. Also note that OnigCodePoint
  is defined as uisigned int.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29445 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-12 05:14:23 +00:00
naruse 000f1c5b75 Add links about floating point. [ruby-core:31849]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-29 00:42:05 +00:00
usa 592d885caa * numeric.c (flo_cmp): typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-27 07:27:48 +00:00
nobu 7bfa1146e2 * numeric.c (flo_cmp): honor the result of infinite? method of the
other.  [ruby-core:31470]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-24 20:37:31 +00:00
mame b79e96ae62 * numeric.c (fix_divide): must not use rb_rational_new1 for coercion
because it returns an argument itself when canonical mode is set.
  [ruby-core:31279]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-15 12:55:23 +00:00
shyouhei ce9c952937 Merge branch 'mybranch' of git://github.com/orangea/ruby into trunk
Conflicts:
	ChangeLog

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28569 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-07 10:59:44 +00:00
akr 26202fba93 * numeric.c (rb_num2long): accept LONG_MAX < x < LONG_MAX+1 and
LONG_MIN-1 < x < LONG_MIN as well because they are converted
  into the valid range of long by truncation.
  (rb_num2ulong): accept ULONG_MAX < x < ULONG_MAX+1 and
  LONG_MIN-1 < x < LONG_MIN as well.
  (rb_num2ll): accept LLONG_MAX < x < LLONG_MAX+1 and
  LLONG_MIN-1 < x < LLONG_MIN.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-01 20:39:32 +00:00
akr 8bab1aff2c * numeric.c (rb_num2ulong): fix the lower limit for float.
[ruby-dev:41361]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28516 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-01 13:34:13 +00:00
drbrain 79aac05474 Clarification of what '*' matches. Patch by John Wells <john.wells at greatworx.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-04 21:22:47 +00:00
nobu eb5f96d70c * numeric.c (rb_num2ulong): explicit cast to suppress a warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27953 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-22 08:14:02 +00:00
nobu e207a3912c * marshal.c (w_float): use dtoa directly instead of stripping
needless trailing .0.

* numeric.c (flo_to_s): reverted.  [ruby-dev:41341]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-21 03:26:00 +00:00
naruse 20eebb8542 * numeric.c (rb_num2ulong): use rb_big2ulong for data from
Bignum. Without this 32bit integer on 32bit environment
  can't converted into long.
  This fixes 1) and 2) of [ruby-dev:41289]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-19 09:22:59 +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
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