summaryrefslogtreecommitdiff
path: root/numeric.c
AgeCommit message (Collapse)Author
2009-02-22merge revision(s) 21298:shyouhei
* numeric.c (ruby_float_step): extracted from num_step(). * range.c (range_step): uses ruby_float_step() for float range. [ruby-dev:37691] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@22528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-04merge revision(s) 18100,18129:shyouhei
* numeric.c (check_uint, rb_num2uint, rb_fix2uint): strict check. fixed [ruby-dev:33683] * numeric.c (check_uint, rb_num2uint, rb_fix2uint): fixed wrong check about 64bit positive value. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@18331 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-02merge revision(s) 17749:17752:shyouhei
* numeric.c (num_coerce): call rb_Float(x) first. don't depend on evaluation order of function arguments. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@17813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-31Merge from ruby_1_8.knu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@16719 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-27Merge from ruby_1_8.knu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@16642 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-14* array.c (rb_ary_collect_bang, rb_ary_select): Return anknu
enumerator if no block is given. * dir.c (dir_each, dir_foreach): Return an enumerator if no block is given. * enum.c (enum_partition, enum_sort_by): Ditto. * gc.c (os_each_obj): Ditto. * hash.c (rb_hash_delete_if, rb_hash_reject_bang, rb_hash_select, rb_hash_each_value, rb_hash_each_key, rb_hash_each_pair, env_each_key, env_each_value, env_each, env_each_pair, env_reject_bang, env_delete_if, env_select): Ditto. * numeric.c (num_step, int_upto, int_downto, int_dotimes): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-11* numeric.c (fix_coerce): try conversion before type check.nobu
[ruby-core:15838] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15749 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-05* numeric.c (int_odd_p): new method Integer#odd?.akr
(int_even_p): new method Integer#even?. (int_pred): new method Integer#pred. (fix_odd_p): new method Fixnum#odd?. (fix_even_p): new method Fixnum#even?. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@14111 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-13* numeric.c (round): fallback definition.nobu
* numeric.c (flo_divmod, flo_round): use round() always. [ruby-dev:32269] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@13914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-13* numeric.c (flodivmod): work around for inifinity.nobu
* numeric.c (flo_divmod): work around for platforms have no round(). [ruby-dev:32247] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@13907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-13* numeric.c (numeric.c): Integer#ord implemented. [ruby-dev:32206]akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@13903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-12* numeric.c (flo_divmod): round to the nearest integer. [ ruby-Bugs-14540 ]shyouhei
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@13902 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-26* numeric.c (fix_pow): returns 1.0 for 0**0.0.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@13786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-26* numeric.c (fix_pow): returns infinity for 0**-1. [ruby-dev:32084]nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@13785 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-19* bignum.c (rb_big_lshift, rb_big_rshift): separated functionsnobu
to get rid of infinite recursion. fixed calculation in edge cases. [ruby-dev:31244] * numeric.c (rb_fix_lshift, rb_fix_rshift): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12814 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-16* numeric.c (fix_pow): integer power calculation: 0**n => 0, matz
1**n => 1, -1**n => 1 (n: even) / -1 (n: odd). * test/ruby/test_fixnum.rb (TestFixnum::test_pow): update test suite. pow(-3, 2^64) gives NaN when pow(3, 2^64) gives Inf. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-13* numeric.c (fix_pow): 0**2 should not raise floating pointmatz
exception. [ruby-dev:31216] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-13* numeric.c (int_pow): wrong overflow detection. [ruby-dev:31215]matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-13* numeric.c (int_pow): wrong overflow detection. [ruby-dev:31213]matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12774 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-05 * numeric.c (int_pow): fix previous nubu's commit.usa
* test/ruby/test_fixnum.rb: new test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-05* numeric.c (int_pow): even number multiplication never be negative.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12697 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-09* numeric.c: purged trailing spaces.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12265 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-09* bignum.c (Init_Bignum), numeric.c (Init_Numeric): added fdiv asnobu
aliases of quo. [ruby-dev:30771] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12263 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-09* numeric.c (int_pow): calculate power in Fixnum as possible.nobu
[ruby-dev:30726] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-23* numeric.c (fix_cmp, fix_equal): Remove FIX2LONG() to optimize.knu
suggested in http://t-a-w.blogspot.com/2007/02/making-ruby-faster.html. [ruby-talk:240223] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-24Minor rdoc fixryan
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11013 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-07* numeric.c (fix_plus): addition in Fixnum will never overflowmatz
long. a patch from Ondrej Bilka <neleai at seznam.cz>. [ruby-core:08794] * numeric.c (fix_minus): ditto. * bignum.c (rb_big_pow): eagerly truncate resulting bignum. [ruby-core:08794] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10880 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-04* numeric.c (flo_hash): improve collision. fixed: [ruby-dev:29352]nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10864 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-01* common.mk, configure.in, defines.h, eval.c, gc.c, main.c,akr
numeric.c, ruby.h, ia64.s: backport IA64 HP-UX support. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-05-01* numeric.c (num_div): use floor rather than rb_Integer().matz
[ruby-dev:28589] * numeric.c (flo_divmod): the first element of Float#divmod should be an integer. [ruby-dev:28589] * test/ruby/test_float.rb: add tests for divmod, div, modulo and remainder. * util.c (ruby_strtod): fixed wrong conversion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-02-05* numeric.c (fix_to_s): removed workaround for radix 2. Historically,ocean
rb_fix2str can only handle radix 8, 10, 16. (Rev1.37) But for now, it can handle radix 2..36. [ruby-Bugs#3438] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-02-04* numeric.c (fix_to_s): (2**32).to_s(2) fails with exception whereocean
sizeof(int) == 4 < sizeof(long). [ruby-core:7300] I think the function name of rb_int2big is quite misleading. This should be "rb_long2big". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9882 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-10-30* ext/readline/readline.c (readline_readline): type check.matz
[ruby-core:6089] * numeric.c (fix_rshift): RDoc fix. [ruby-core:6351] * util.h (strtod): add #undef for platforms defines strtod() macro. [ruby-dev:27563] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9483 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-28* class.c (rb_mod_init_copy, rb_class_init_copy), file.c (rb_stat_init_copy),nobu
numeric.c (num_init_copy), object.c (rb_obj_init_copy, Init_Object), re.c (match_init_copy, rb_reg_init_copy), time.c (time_init_copy): undocumented. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-07-22* bignum.c (rb_big_eq): reduce isnan(). [ruby-dev:26600]matz
* numeric.c (flo_eq, flo_gt, flo_ge, flo_lt, flo_le): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-05-24* numeric.c (fix_pow): support Fixnum ** Float case directlymatz
without coercing. [ruby-talk:142697] [ruby-talk:143054] * ruby.c (require_libraries): caused SEGV when continuation jumped in to the required library code. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8515 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-05-10* numeric.c (flo_plus): small typo fix. [ruby-core:4636]ocean
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-02-28* exception error messages updated. [ruby-core:04497]matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-01-11* numeric.c (Init_Numeric): turn off floating point exceptionsocean
on bcc32. "1e300".to_f had crashed by overflow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-18* process.c (proc_getpgrp): prohibit for $SAFE=2.matz
[ruby-dev:24899] * process.c (get_pid): ditto. [ruby-dev:24904] * process.c (get_ppid): ditto. * array.c (rb_ary_delete): defer rb_ary_modify() until actual modification. [ruby-dev:24901] * parse.y (newline_node): should not use FL_SET. [ruby-dev:24874] * parse.y (string_content): should not use FL_UNSET. * node.h (NODE_NEWLINE): remove unused bit to utilize flag field in nodes. * string.c (rb_str_splice): move rb_str_modify() after StringValue(), which may alter the receiver. [ruby-dev:24878] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-16* numeric.c (flo_divmod): protect float values from GC bymatz
assignment to local variables. [ruby-dev:24873] * string.c (str_mod_check): frozen check should be separated. [ruby-core:3742] * array.c (rb_ary_update): pedantic check to detect rb_ary_to_ary() to modify the receiver. [ruby-dev:24861] * string.c (rb_str_justify): typo fixed. [ruby-dev:24851] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7290 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-27* string.c (RESIZE_CAPA): check string attribute before modifyingmatz
capacity member of string structure. [ruby-dev:24594] * ext/zlib/zlib.c (gzreader_gets): use memchr() to to gain performance. [ruby-talk:117701] * sprintf.c (rb_f_sprintf): raise ArgumentError for extra arguments, unless (digit)$ style used. * ext/zlib/zlib.c (gzreader_gets): use memchr() to to gain performance. [ruby-talk:117701] * sprintf.c (rb_f_sprintf): raise ArgumentError for extra arguments, unless (digit)$ style used. * eval.c (frame_free): Guy Decoux solved the leak problem. Thanks. [ruby-core:03549] * ext/zlib/zlib.c (zstream_append_input): clear klass for z->input to avoid potential vulnerability. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-07-09* array.c, enum.c, pack.c: rdoc patch from Johan Holmbergocean
<holmberg@iar.se> [ruby-core:3132] [ruby-core:3136] * numeric.c: rdoc patch. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6607 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-06-16* eval.c (rb_mod_freeze): prepare string representation beforematz
freezing. [ruby-talk:103646] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-06-04* io.c (rb_io_gets_m): set lastline ($_) even when read line ismatz
nil. [ruby-dev:23663] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-05-20* numeric.c (flo_eq): alway check if operands are NaN.matz
[ruby-list:39685] * lib/cgi/session.rb: use LOCK_SH to read, and a few other improvements. [ruby-core:02328] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6371 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-05-17* numeric.c (flo_to_s): p 0.0 should be '0.0' not '0.0e+00'.ocean
* numeric.c (flo_to_s): the number of significand is correctly handled, there is assumption that DBL_DIG == 15 though. (p 0.00000000000000000001 was '9.999999999999999e-21', now is '1.0e-20') git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-05-07* eval.c (rb_eval): too many line trace call. (ruby-bugs PR#1320)matz
* numeric.c (flo_to_s): tweak output string based to preserve decimal point and to remove trailing zeros. [ruby-talk:97891] * string.c (rb_str_index_m): use unsigned comparison for T_FIXNUM search. [ruby-talk:97342] * hash.c (rb_hash_equal): returns true if two hashes have same set of key-value set. [ruby-talk:97559] * hash.c (rb_hash_eql): returns true if two hashes are equal and have same default values. * string.c (rb_str_equal): always returns true or false, never returns nil. [ruby-dev:23404] * io.c (rb_io_reopen): should use rb_io_check_io(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6263 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-04-14* numeric.c (flo_eq): workaround for bcc32's bug.eban
(ruby-bugs-ja:PR#594) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6159 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-04-14* array.c, enum.c, eval.c, file.c, io.c, numeric.c, object.c, prec.c,nobu
process.c, re.c, string.c: typos in RDoc comments. [ruby-core:02783] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e