summaryrefslogtreecommitdiffstats
path: root/numeric.c
Commit message (Collapse)AuthorAgeFilesLines
* * numeric.c (flo_to_s): reduce fragments if no precision lost.nobu2009-04-061-3/+6
| | | | | | | c.f. [ruby-core:23075] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * file.c (sys_fail2, rb_file_s_readlink, BUFCHECK, rmext),nobu2009-04-061-1/+1
| | | | | | | (rb_file_s_basename): get rid of overflow. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (int_chr): checsk overflow.nobu2009-04-061-1/+4
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c, bignum.c, dln.c, error.c, gc.c, io.c, marshal.c,nobu2009-03-121-1/+1
| | | | | | | | | | 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
* * marshal.c (div0), numeric.c (infinite_value): new functions tonobu2009-03-121-3/+16
| | | | | | | get rid of VC divion by 0 warnings. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c, bignum.c, gc.c, numeric.c, string.c, util.c, insns.def,nobu2009-03-101-4/+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
* * numeric.c (flo_to_s): keeps enough precision for round trip.nobu2009-03-051-3/+5
| | | | | | | [ruby-core:22325] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (flo_eq, flo_gt, flo_ge, flo_lt, flo_le, flo_eql): revertusa2009-02-271-1/+36
| | | | | | | | | | isnan() checks for VC++6. * insns.def (opt_lt, opt_gt): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (flo_eq): remove unnecessary NaN check using isnan().matz2009-02-231-15/+2
| | | | | | | | comparison regarding NaN is false anyway. * numeric.c (flo_gt, flo_ge, flo_lt, flo_le, flo_eql): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* stripped trailing spaces.nobu2009-02-221-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (ruby_float_step): extracted from num_step().nobu2009-01-041-21/+29
| | | | | | | | * range.c (range_step): uses ruby_float_step() for float range. [ruby-dev:37691] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21298 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c: Infinity.numerator returns self. [experimental]tadf2008-12-291-0/+20
| | | | | | | | * numeric.c: Infinity.denominator returns 1. [experimental] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21176 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* arrangementtadf2008-12-291-2/+2
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (int_ord): Integer#ord implemented.akr2008-12-221-0/+21
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * configure.in (mingw): no longer uses snprintf and vsnprintf ofnobu2008-12-221-4/+4
| | | | | | | | | | | | | | | | | | msvcrt. * win32/win32.c (rb_w32_vsnprintf, rb_w32_snprintf): removed. * win32/Makefile.sub (config.h): vsnprintf exists in VC7 or later. * win32/mkexports.rb (Exports#initialize): aliases rb_w32_vsnprintf and rb_w32_snprintf for binary compatibility. * sprintf.c (rb_str_format): uses snprintf instead of sprintf. * numeric.c (flo_to_s, rb_num2long, rb_num2ll): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (flodivmod): floating point division should raisematz2008-11-271-0/+1
| | | | | | ZeroDivisionError as integer division. [incompatible] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (num_step): treat infinite step specially.matz2008-11-241-4/+9
| | | | | | [ruby-dev:37157] fix: #781. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20348 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (num_sadded): remove newly defined singleton methodmatz2008-10-181-1/+3
| | | | | | that should not exist after exception handling. [ruby-dev:36569] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fixed indentation.tadf2008-09-211-2/+2
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19443 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * prec.c: removed. Precision will be redesigned and be back again.yugui2008-09-191-67/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | c.f. [ruby-dev:36352]. * common.mk (COMMON_OBJS): removed prec.o. * inits.c (rb_call_inits): removed Init_Precision. * numeric.c (Init_Numeric): removed inclusion of Precision. removed #induced_from from each class. * rational.c: ditto. * ext/bigdecimal/bigdecimal.c: ditto. * lib/rdoc/knwon_classes.rb: removed the entry for Precision. * test/ruby/test_prec.rb: removed. * test/ruby/test_integer.rb: removed tests for Precision. * test/ruby/test_fixnum.rb: ditto. * test/ruby/test_float.rb: ditto. * test/ruby/test_rational.rb: ditto. * test/ruby/test_complex.rb: ditto. * test/bigdecimal/test_bigdecimal.rb: ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * dln.c: newer BeOS support. a patch from Pete Goodevematz2008-09-191-0/+3
| | | | | | <pete.goodeve at computer.org> in [ruby-core:18712]. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c: provides predicate real? instead of scalar?.tadf2008-09-161-4/+4
| | | | | | | | | | * complex.c: follows the above change. * lib/cmath.c: ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19393 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h (DBL2NUM): renamed from DOUBLE2NUM.matz2008-09-051-39/+39
| | | | | | | 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
* * complex.c ({nucomp,numeric}_rect): new.tadf2008-08-291-0/+3
| | | | | | | | | | | | | | | | | | | | | | | * complex.c: added some aliases (::rectangular, ::rect, #rectangular, #rect, #phase, #magnitude). * complex.c (string_to_c_internal): should not strip any null bytes. * rational.c (string_to_r_internal): ditto. * rational.c (i_gcd): reverted to nurat 0.0.2's one. * numeric.c: added an alias (#magnitude). * test/ruby/test_complex.rb: added assertions. * test/ruby/test_rational.rb: ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h (rb_intern_const): tiny optimization.nobu2008-08-161-0/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (check_uint): fix wrong message.usa2008-07-181-8/+2
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (check_uint, rb_num2uint, rb_fix2uint): fixed wrong checkusa2008-07-181-14/+15
| | | | | | | | about 64bit positive value. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (check_uint, rb_num2uint, rb_fix2uint): strict check.usa2008-07-171-10/+19
| | | | | | | | fixed [ruby-dev:33683] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (check_uint, rb_num2uint, rb_fix2uint): proper check.usa2008-07-041-4/+10
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (rb_num2uint, rb_fix2uint): typo.usa2008-07-031-2/+2
| | | | | | | * ChangeLog: format. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (check_uint, rb_num2uint): also needs checking negativeusa2008-07-031-8/+4
| | | | | | | | value. see [ruby-dev:33683] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (num_coerce): call rb_Float(x) first. don't depend onakr2008-06-301-1/+3
| | | | | | | evaluation order of function arguments. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (flo_round): get rid of overflow.nobu2008-06-211-5/+10
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h (CONST_ID): constant ID cache for non-gcc.nobu2008-06-091-0/+2
| | | | | | | * *.c: no cache in init functions. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c: "%" is required before PRI?VALUE.akr2008-05-271-4/+4
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (num_div): should raise ZeroDivisionError.matz2008-05-271-1/+6
| | | | | | | | | * numeric.c (fix_divide): ditto. * test/ruby/test_numeric.rb (TestNumeric::test_divmod): avoid ZeroDivisionError in tests. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (num_fdiv): fallback to_f should always return floatmatz2008-05-271-1/+15
| | | | | | result. should not use #quo that may return rational. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16649 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (check_int): use PRIxVALUE format specifier.matz2008-05-271-12/+4
| | | | | | * numeric.c (check_uint, rb_num2fix, int_chr): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (bit_coerce): float should not be a valid operand ofmatz2008-05-071-5/+9
| | | | | | bitwise operations. [ruby-dev:34583] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16316 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (fix_divide): float division should floor() beforematz2008-05-071-1/+1
| | | | | | rounding into integer. [ruby-dev:34584] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16314 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (sym_to_i): remove obsolete method. preparation formatz2008-05-071-49/+0
| | | | | | | | | | symbol GC. * numeric.c (fix_to_sym): ditto. * numeric.c (fix_id2name): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big_fdiv): flo.fdiv(NaN) should result NaN.matz2008-05-071-13/+4
| | | | | | | | | | | | | | * 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-10/+12
| | | | | | | domain. [ruby-dev:34559] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16258 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c: cancelled recent changes (except to remove rdiv).tadf2008-04-071-28/+22
| | | | | | | | | | * 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
* * numeric.c (num_quo): RDoc updated.matz2008-04-031-4/+4
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (Init_Bignum): rdiv method removed. [ruby-dev:34242]matz2008-04-031-20/+6
| | | | | | | | | | | | * 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
* * numeric.c (num_rdiv): should always return rational number.matz2008-04-021-29/+40
| | | | | | | | | | | * rational.c (nurat_add, nurat_sub, nurat_mul, nurat_fdiv, nurat_cmp): use rb_num_coerce_bin(). * rational.c (nurat_division): does / and rdiv. * .gdbinit (rp): no longer use rb_p(). git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (num_quo): should convert its operand to Rational.matz2008-03-311-2/+2
| | | | | | | | | * 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
* both complex and rational are now builtin classes.tadf2008-03-161-6/+63
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (flo_divmod): remvoed unused variable.nobu2008-03-141-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e