Граф коммитов

92 Коммитов

Автор SHA1 Сообщение Дата
tadf 0bd29ba216 * complex.c (nucomp_div): raises ZeroDivisionError immediately
when the given second argument is zero.

	* rational.c (nurat_fdiv): never raise even if the given second
	  argument is zero.

	* rational.c (rb_raise_zerodiv): changed the message (zero to 0).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-28 14:39:31 +00:00
tadf 268432c51d * complex.c (nucomp_expt): convert to a float when the given power
is a bignum.

	* rational.c (nurat_expt): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23883 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-28 13:27:48 +00:00
tadf f365778c26 * complex.c (nucomp_expt): some improvements.
* rational.c (nurat_expt): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23881 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-28 10:50:39 +00:00
tadf 53125214cc * complex.c: renamed some static functions.
* rational.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-28 00:22:07 +00:00
tadf f94228c8bd * rational.c (nurat_cmp): use rb_num_coerce_cmp.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-27 07:58:15 +00:00
tadf b2fb759624 * complex.c: revised rdoc.
* rational.c: ditto.

	* numeric.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-27 07:46:57 +00:00
tadf d82ed7e2c6 * numeric.c (num_div): don't use num_floor which is actually
flo_floor.

	* numeric.c (num_modulo): don't call '%'.

	* numeric.c (num_divmod): use num_modulo.

	* numeric.c: defined '%'.

	* rational.c (nurat_idiv,nurat_mod,nurat_divmod,nurat_rem): removed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-20 12:37:13 +00:00
tadf 40d6a7527e * complex.c: edited rdoc.
* rational.c: ditto.

	* numeric.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-19 23:57:34 +00:00
tadf ab7baebb6d * complex.c: edited rdoc.
* rational.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23753 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-19 21:57:51 +00:00
tadf 63f2557b56 * complex.c; edited rdoc.
* rational.c; ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-19 20:10:13 +00:00
tadf c21b9570dc * rational.c (nurat_abs); removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-19 19:31:41 +00:00
tadf ed0bdbc575 * rational.c; edited rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-19 13:59:08 +00:00
tadf f86ad72d2a due to conflict
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-19 13:37:04 +00:00
tadf 03f49cbb32 * complex.c: constant COMPLEX_NAME has been removed.
* rational.c: constant RATIONAL_NAME has been removed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-19 11:47:53 +00:00
tadf a6e1a03e07 * rational.c: added rdoc. a patch from Run Paint Run Run.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-19 11:42:07 +00:00
tadf 5134783cde * numeric.c (*_numerator,*_denominator): moved to rational.c.
* rational.c (*_numerator,*_denominator): moved from numeric.c.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-19 00:31:08 +00:00
tadf 67f93ddc21 * rational.c (nurat_s_convert): calls to_r when the given argument
is non-integer.

	* rational.c (nurat_s_convert): raises TypeError when the given
	  argument is nil.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-18 13:41:44 +00:00
tadf cefaa1680c * rational.c (nurat_coerce): accepts Complex when the imag is
exact zero.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-17 14:49:10 +00:00
tadf b6849b2502 * bignum.c (rb_big_fdiv): checks whether the given second argument
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: svn+ssh://ci.ruby-lang.org/ruby/trunk@23726 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-17 12:55:16 +00:00
tadf ad52268581 * complex.c (nucomp_coerce): accepts Complex instances.
* rational.c (nurat_coerce): accepts Rational
	  instances. [ruby-core:23859]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-16 23:17:17 +00:00
tadf 9540aa5b7b * complex.c (nucomp_fdiv): use fdiv recursively.
* complex.c (nucomp_expt): reduced code.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-13 22:57:02 +00:00
tadf 63721ea54e * rational.c (nurat_to_f): use fdiv.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-13 16:25:16 +00:00
mame e722ad99d5 * string.c (rb_hash_uint32, rb_hash_uint, rb_hash_start, rb_hash_end),
include/ruby/intern.h: add Murmurhash API.  [ruby-dev:37784]

* complex.c (nucomp_hash), array.c (rb_ary_hash), time.c (time_hash),
  string.c (rb_str_hsah), object.c (rb_obj_hash), range.c
  (range_hash), struct.c (rb_struct_hash), hash.c (rb_any_hash),
  rational.c (nurat_hash): use Murmurhash.  [ruby-dev:37784]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22317 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-14 19:55:34 +00:00
tadf c7e236efc1 * bignum.c (rb_cstr_to_inum): changed an error message.
* 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
2008-12-29 14:26:16 +00:00
tadf d7b873a108 * rational.c: floor, ceil, truncate and round accept an extra
argument like Float#round. [experimental]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21173 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-29 11:50:10 +00:00
tadf ac6e87fc59 * complex.c: use rb_usascii_str_new2 instead of rb_str_new2.
* rational.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-13 04:05:25 +00:00
tadf 8729368f14 * complex.c (nucomp_canonicalization): renamed.
* ext/math/complex.c: followed the above change.

	* rational.c (nurat_canonicalization): renamed.

	* ext/math/rational.c: followed the above change.

	* configure.in: defines a new macro.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-12 23:40:55 +00:00
tadf 75fbac3b0d * complex.c, rational.c: do not use RUBY_VERSION_CODE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-12 13:13:44 +00:00
nobu 8e3bf17b03 * complex.c, rational.c: do not use RUBY_VERSION_CODE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-12 01:20:57 +00:00
tadf 32bc841571 * complex.c: avoided warnings on cpp.
* rational.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-10 15:00:13 +00:00
tadf d5d39dd3fe * rational.c (nurat_{to_s,inspect}): performance improvement.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-05 12:47:07 +00:00
tadf 2b72e549a7 * complex.c: continues to support canonicalization *unofficially*
for an odd library mathn for the time being (only 1.9.x).
	  since grand mathn is must be very very special library for us.

	* rational.c: ditto.

	* ext/mathn/*/*: follow the above changes.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20001 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-28 14:11:08 +00:00
nobu cb723edfc8 * complex.c (Init_Complex), rational.c (Init_Rational): undefines
default #allocate methods which call the allocater.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-24 08:44:47 +00:00
nobu 9aac312f77 * complex.c (Init_Complex), rational.c (Init_Rational): ID_ALLOCATOR
differs from :allocate, and invisible in ruby level.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-24 08:02:17 +00:00
tadf 8b54d5812c * complex.c (nucomp_s_canonicalize_internal): does no apply
canonicalization rule anymore.

	* rational.c (nurat_s_canonicalize_internal(_no_reduce)?): ditto.

	* complex.c: removed class method new! and new.

	* rational.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19483 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 10:33:27 +00:00
tadf cbae6d0911 * complex.c: added two macros.
* rational.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19446 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-21 12:21:32 +00:00
tadf a46544a4f9 * complex.c (nucomp_s_convert): checks argc.
* rational.c (nurat_s_convert): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19445 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-21 09:07:25 +00:00
tadf 72565402d9 * complex.c (nucomp_s_canonicalize_internal): checks exactness of
imag only.

	* rational.c (nurat_s_convert): accepts non real value
	  (Rational(a,b) as a/b).

	* complex.c (nucomp_s_convert): refined.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19442 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-21 01:30:25 +00:00
tadf 9467d7a024 * complex.c: an instance method image has been removed and
uses "imag" instead of "image".

	* complex.c: two instance method re and im are removed.

	* rational.c: follows the above changes.

	* include/ruby/ruby.h: ditto.

	* gc.c: ditto.

	* lib/cmath.rb: ditto.

	* lib/mathn.rb: ditto.

	* lib/complex.rb: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-20 22:49:56 +00:00
tadf f2cb79ffee * complex.c: uses f_(in)?exact_p macro.
* 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
2008-09-19 13:55:52 +00:00
yugui 396650e0bd * prec.c: removed. Precision will be redesigned and be back again.
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: svn+ssh://ci.ruby-lang.org/ruby/trunk@19430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-19 13:10:54 +00:00
tadf d965e99b04 * complex.c (nucomp_s_convert): accepts complex
value (Complex(a,b) as a+bi).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-17 11:00:09 +00:00
tadf 7c3b57b5d1 * complex.c (nucomp_marshal_{dump,load}): preserve instance
variables.

	* rational.c (nurat_marshal_{dump,load}): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-16 10:21:23 +00:00
ko1 69029b90fe * gc.c, include/ruby/ruby.h: rename rb_register_mark_object()
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
2008-09-15 14:59:14 +00:00
tadf b140cda1d6 fixed the previous commit.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-15 05:04:09 +00:00
tadf 05ac51d225 * complex.c (nucomp_eql_p): new.
* complex.c (nucomp_hash): should use hash values of the elements.

	* rational.c (nurat_hash): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-15 04:20:46 +00:00
tadf 583400c15e * complex.c: trivial changes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-14 09:35:08 +00:00
tadf e4b3a81769 * complex.c (f_{add,mul,sub}): omitted some shortcuts for preserve
signed zero anyway.

	* complex.c (nucomp_negate): new.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-14 01:16:44 +00:00
tadf 5ac09d7627 * complex.c: refined.
* rational.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19319 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-13 01:55:56 +00:00
tadf 0de54d9aa6 * complex.c: some adjustments.
* rational.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-07 22:10:38 +00:00