aboutsummaryrefslogtreecommitdiffstats
path: root/bignum.c
Commit message (Collapse)AuthorAgeFilesLines
* * 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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/ruby/trunk@20739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (bigmul1_karatsuba): fix comment and refactoring.mame2008-12-141-4/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/ruby/trunk@18931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c: added an alias (#magnitude).tadf2008-08-291-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/ruby/trunk@15799 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* both complex and rational are now builtin classes.tadf2008-03-161-4/+17
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix doc.akr2008-03-091-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c: fix indent.mame2008-03-071-91/+91
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/ruby/trunk@15691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (big2str_find_n1): check integer overflow.nobu2008-02-291-0/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/ruby/trunk@15437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* adjustmenttadf2008-01-301-10/+9
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_cstr_to_inum): '0_2' is a valid representatin.tadf2008-01-301-3/+11
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c: move object allocation out of blocking_region.mame2008-01-291-58/+64
| | | | | | | [ruby-dev:33139] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big2str0): should be US-ASCII.usa2008-01-281-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15298 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_usascii_new{,2}: defined.naruse2008-01-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | (rb_str_new): set US-ASCII and ENC_CODERANGE_7BIT when empty string. * encoding.c (rb_usascii_encoding, rb_usascii_encindex): defined. (rb_enc_inspect, enc_name, rb_locale_charmap, rb_enc_name_list_i): use rb_str_ascii_new. * array.c (recursive_join, inspect_ary): ditto. * object.c (nil_to_s, nil_inspect, true_to_s, false_to_s, rb_mod_to_s): ditto. * hash.c (inspect_hash, rb_hash_inspect, rb_f_getenv, env_fetch, env_clear, env_to_s, env_inspect): ditto. * numeric.c (flo_to_s, int_chr, rb_fix2str): ditto. * bignum.c (rb_big2str): ditto. * file.c (rb_file_ftype, rb_file_s_dirname, rb_file_s_extname, file_inspect_join, Init_file): ditto. * test/ruby/test_ruby_m17n.rb: add checks for encoding of string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (big_shift): fix a bug that caused infinite loop whenmame2008-01-211-1/+1
| | | | | | | left shifting. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * $Date$ keyword removed to avoid inclusion of locale dependentakr2008-01-061-1/+0
| | | | | | | string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (conv_digit): use ISDIGIT, ISLOWER and ISUPPER.akr2008-01-021-3/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14855 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* don't need to include ruby/util.h.akr2008-01-021-1/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14853 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * util.c (ruby_strtoul): locale independent strtoul is implemented toakr2008-01-021-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | avoid "i".to_i(36) cause 0 under tr_TR locale. This is newly implemented, not a copy of missing/strtoul.c. * include/ruby/ruby.h (ruby_strtoul): declared. (STRTOUL): defined to use ruby_strtoul. * bignum.c, pack.c, ext/socket/socket.c: use STRTOUL. * configure.in (strtoul): don't check. * missing/strtoul.c: removed. * include/ruby/missing.h (strtoul): removed. * common.mk (strtoul.o): removed. * LEGAL (missing/strtoul.c): removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14850 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix typos.akr2007-12-311-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * pack.c (pack_pack): use NUM2LONG instead of NUM2INT.usa2007-12-241-3/+3
| | | | | | | | | | | * numeric.c (fix_lshift, fix_aref): use SIZEOF_LONG instead of SIZEOF_VALUE. * bignum.c (big2ulong, rb_big_aref): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big_mul0): remove unused variable.matz2007-12-211-2/+0
| | | | | | * bignum.c (bigdivrem): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * regerror.c, string.c, io.c, lib/getoptlong.rb, lib/net/imap.rb,akr2007-12-211-3/+3
| | | | | | | | | | | compile.c, sprintf.c, parse.y, ext/win32ole/win32ole.c, ext/tk/sample/demos-en/entry3.rb, ext/tk/lib/tcltk.rb, ext/openssl/ossl_bn.c, numeric.c, vm.c, benchmark/bm_so_meteor_contest.rb, bignum.c, ruby.c: don't "illegal" for non law violation context. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (big2str_orig): access beyond memory region cause crashmatz2007-12-201-2/+2
| | | | | | | on interrupt. a patch from Yusuke ENDOH <mame AT tsg.ne.jp> in [ruby-dev:32651]. [ruby-dev:32641] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e