summaryrefslogtreecommitdiffstats
path: root/bignum.c
Commit message (Collapse)AuthorAgeFilesLines
* * removed spaces just before tabs.nobu2009-11-261-4/+4
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@25930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c: rdoc for <=>, casecmpmarcandre2009-10-281-1/+1
| | | | | | | | | | | | * bignum.c: rdoc for <=> * file.c: ditto * time.c: ditto * compar.c: rdoc git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@25522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (big_split): fix off-by-one error. [ruby-dev:39501]mame2009-10-171-4/+4
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@25383 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix rdoc.akr2009-10-121-2/+2
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@25314 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (bigmul1_single): suppress a warning.nobu2009-09-131-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/st.h (st_hash_func): use st_index_t.nobu2009-09-081-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big_idiv): added rdoc.nobu2009-09-041-1/+10
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24749 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big_div, rb_big_idiv): fixed indent.nobu2009-09-041-2/+2
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (bigmul1_single): new function specialized respect toakr2009-08-301-0/+19
| | | | | | | | | multiply two single digit bignums. (bigmul0): use bigmul1_single. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24708 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big_clone, bigmul1_normal, bigdivrem): trivialnobu2009-08-251-26/+29
| | | | | | | | | | optimization. * bignum.c (big2dbl): truncates zero digits to get rid of possible underflow. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (flo_pow,fix_pow): may return complex number.tadf2009-08-161-0/+2
| | | | | | | | * bignum.c (rb_big_pow): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * insns.def, vm.c, vm_insnhelper.c, vm_insnhelper.h: checkko12009-08-121-0/+1
| | | | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@24511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big_cmp, bigsub, big_real_len, bigmul1_normal,mame2009-08-091-16/+32
| | | | | | | bigmul1_balance, big_split): remove BDIGITS() inside of the loops. same as r24444. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24481 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (bigzero_p): removing BDIGITS() inside of thematz2009-08-081-1/+3
| | | | | | | loop. inspired by Hitohiro Kanai's blog entry <http://d.hatena.ne.jp/CanI/20090807/1249657492>. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * suppressed shorten-64-to-32 warnings.nobu2009-07-181-6/+6
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big_new, rb_bigzero_p), range.c (rb_range_values):nobu2009-07-161-0/+12
| | | | | | | added for random.c. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * 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