summaryrefslogtreecommitdiffstats
path: root/bignum.c
Commit message (Collapse)AuthorAgeFilesLines
* * bignum.c (big_lshift, big_rshift): return Bignum always withoutnobu2009-06-181-21/+21
| | | | | | | normalization. [ruby-dev:38679] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (flo_cmp): Infinity is greater than any bignummatz2009-06-171-1/+9
| | | | | | | | number. [ruby-dev:38672] * bignum.c (rb_big_cmp): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big_fdiv): checks whether the given second argumenttadf2009-06-171-45/+58
| | | | | | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@23726 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* avoid signbit() and adjust indentation.tadf2009-06-151-3/+3
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23698 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big2db): (-Float::MAX.to_i*2).to_f should returntadf2009-06-151-1/+4
| | | | | | | | -HUGE_VAL (-Infinity). git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (bigand_int): new function to calculate bignum andmatz2009-05-271-19/+133
| | | | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@23596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * common.mk (bignum.o, numeric.o): depend on util.h.nobu2009-05-261-25/+46
| | | | | | | | | | | * 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: http://svn.ruby-lang.org/repos/ruby/trunk@23575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (bignew_1): inline memory allocation.matz2009-05-261-6/+12
| | | | | | | | * bignum.c (bigtrunc): call rb_big_resize() only when needed. * bignum.c (bigfixize): declare inline. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23574 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (bigsub_int): subtraction without making internalmatz2009-04-201-6/+136
| | | | | | | | | | | | bignum values. * bignum.c (bigadd_int): ditto for addition. * bignum.c (bigtrunc): declare inline. * bignum.c (rb_quad_pack): fix condition. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_cmpint): FIX2INT may fail on LP64 platforms.akr2009-03-261-1/+6
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (bigfixize): zero length Bignum is 0.nobu2009-03-131-1/+2
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c, bignum.c, dln.c, error.c, gc.c, io.c, marshal.c,nobu2009-03-121-12/+17
| | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@22914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c, bignum.c, gc.c, numeric.c, string.c, util.c, insns.def,nobu2009-03-101-3/+4
| | | | | | | missing/crypt.c, missing/vsnprintf.c, : suppress warnings. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* stripped trailing spaces.nobu2009-02-221-2/+2
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_cstr_to_inum): changed an error message.tadf2008-12-291-1/+1
| | | | | | | | | | * complex.c (string_to_c_strict): ditto. * rational.c (string_to_r_strict): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (bigmul1_karatsuba): remove temporal bignum.mame2008-12-141-54/+28
| | | | | | | | | | | * 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: http://svn.ruby-lang.org/repos/ruby/trunk@20739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (bigmul1_karatsuba): fix comment and refactoring.mame2008-12-141-4/+4
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (bigmul1_balance, bigmul1_karatsuba): remove allmame2008-12-141-10/+0
| | | | | | | rb_gc_force_recycle which causes memory leak. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big_mul): faster multiplication by Karatsuba method andmame2008-12-141-68/+327
| | | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@20733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c: uses f_(in)?exact_p macro.tadf2008-09-191-4/+1
| | | | | | | | | | | | | | | | | | | | | | | * 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: http://svn.ruby-lang.org/repos/ruby/trunk@19431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (big2str_karatsuba): free internal buffer eagerly.matz2008-09-181-0/+3
| | | | | | | | | a patch from TOYOFUKU Chikanobu <nobu_toyofuku at nifty.com> in [ruby-dev:36217]. * bignum.c (rb_big2str0): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19414 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c, include/ruby/ruby.h: rename rb_register_mark_object()ko12008-09-151-1/+1
| | | | | | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@19365 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (bigdivrem): adjust length for division and remainder.matz2008-09-111-0/+2
| | | | | | | a patch from TOYOFUKU Chikanobu <nobu_toyofuku at nifty.com> in [ruby-dev:36231]. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19293 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (big2str_karatsuba): remove unnecessary fixnum code. amatz2008-09-111-17/+2
| | | | | | | patch from TOYOFUKU Chikanobu <nobu_toyofuku at nifty.com> in [ruby-dev:36217]. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (bigdivrem1): optimization by skipping zeros at thematz2008-09-051-2/+3
| | | | | | | tail of digits. a patch from TOYOFUKU Chikanobu <nobu_toyofuku at nifty.com> in [ruby-dev:36169]. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19171 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h (DBL2NUM): renamed from DOUBLE2NUM.matz2008-09-051-8/+8
| | | | | | | a patch from Tadashi Saito <shiba at mail2.accsnet.ne.jp> in [ruby-dev:36102]. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (bigdivmod): remove redundant code. a patch frommatz2008-08-291-3/+2
| | | | | | TOYOFUKU Chikanobu <nobu_toyofuku at nifty.com> in [ruby-dev:36044]. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c: added an alias (#magnitude).tadf2008-08-291-0/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c, bignum.c, cont.c, dir.c, dln.c, encoding.c, enumerator.c,ko12008-06-081-1/+1
| | | | | | | | | | | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@17017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (bigzero_p): check from MSB to LSB. [ruby-dev:34649]akr2008-05-121-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16384 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big_and): bit-wise operation should not take floatmatz2008-05-081-3/+15
| | | | | | | | | | values. [ruby-dev:34612] * bignum.c (rb_big_or): ditto. * bignum.c (rb_big_xor): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big_fdiv): flo.fdiv(NaN) should result NaN.matz2008-05-071-12/+5
| | | | | | | | | | | | | | * 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: http://svn.ruby-lang.org/repos/ruby/trunk@16308 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big_divide), numeric.c (fix_divide): check for resultnobu2008-05-011-1/+1
| | | | | | | domain. [ruby-dev:34559] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16258 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big_divide): return an integer for idiv.nobu2008-05-011-1/+9
| | | | | | | [ruby-dev:34553] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c: cancelled recent changes (except to remove rdiv).tadf2008-04-071-9/+23
| | | | | | | | | | * bignum.c: ditto. * bignum.c: added rb_big_idiv. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_cmpint): moved from compar.c, to check bignummatz2008-04-061-0/+17
| | | | | | | | | zero. * range.c (range_step): add step for each iteration if begin and end are numeric. [ruby-core:15990] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (Init_Bignum): rdiv method removed. [ruby-dev:34242]matz2008-04-031-1/+0
| | | | | | | | | | | | * 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: http://svn.ruby-lang.org/repos/ruby/trunk@15897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (big2dbl): more precise conversion at edge cases.nobu2008-04-011-4/+53
| | | | | | | [ruby-dev:34195] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15881 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (num_quo): should convert its operand to Rational.matz2008-03-311-3/+1
| | | | | | | | | * 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: http://svn.ruby-lang.org/repos/ruby/trunk@15866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_cstr_to_inum): treat successive underscores asnobu2008-03-191-3/+4
| | | | | | | nondigit. [ruby-dev:34089] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15799 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* both complex and rational are now builtin classes.tadf2008-03-161-4/+17
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix doc.akr2008-03-091-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c: fix indent.mame2008-03-071-91/+91
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (power_cache_init, power_cache_get_power0, Init_Bignum):mame2008-03-071-10/+5
| | | | | | | delayed initializing power cache per base. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (fix_to_s): avoid rb_scan_args() when no argumentmatz2008-03-051-3/+6
| | | | | | | | | | | | | | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@15691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (big2str_find_n1): check integer overflow.nobu2008-02-291-0/+3
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (big2str_karatsuba): initialize cache if not initialized.usa2008-02-251-2/+5
| | | | | | | | * bignum.c (Init_Bignum): delayed initializing cache. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (BIGZEROP): fix for longer Bignum zeros. [ruby-Bugs-17454]nobu2008-02-221-1/+13
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (rb_num_coerce_bin): add ID argument to specifymatz2008-02-121-10/+10
| | | | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@15437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* adjustmenttadf2008-01-301-10/+9
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e