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

66 Коммитов

Автор SHA1 Сообщение Дата
shugo a98cbcbf0b * complex.c (f_signbit): regard NaN as a positive value.
[ruby-dev:37861].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21945 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-02 03:45:28 +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 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 2d3f41d19f * complex.c: inpsect should not depend on to_s.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-05 12:44:06 +00:00
tadf ef38a43c50 * complex.c (nurat_{to_s,inspect}): provides better representation
for in-finite imag part.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20474 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-03 16:43:01 +00:00
tadf 28c53aabca * complex.c (f_signbit): NaN may be signed value.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-03 16:28:17 +00:00
takano32 2100e3b631 * complex.c (imp1, imp2): should declare type.
[BUG] at IA-64


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-29 06:45:26 +00:00
tadf f68296698a * complex.c: uses macro in declarations.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20011 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-28 15:45:29 +00:00
tadf 2d5a281c98 * math.c (rb_math_{atan2,cos,cosh,hypot,log,sin,sinh,sqrt}): added.
* complex.c: follows the above change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20005 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-28 15:10:40 +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 359945ec7f * complex.c (m_sqrt): unused.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-13 00:55: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 83b381752e fixed previous commit.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-21 12:32:33 +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 2897cdae9b trivial changes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-21 04:59:53 +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
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 acde7364f7 * numeric.c: provides predicate real? instead of scalar?.
* complex.c: follows the above change.

	* lib/cmath.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19393 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-16 22:04:19 +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 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
tadf 803aafe7c4 * complex.c: uses f_real_p macro.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-05 22:55:35 +00:00
tadf 1d9a079b1c * complex.c (numeric_abs2): new.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-31 11:51:04 +00:00
tadf 5185955f3f * complex.c ({nucomp,numeric}_rect): new.
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@18925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-29 13:41:41 +00:00
tadf 8f40b26581 * complex.c (nucomp_div): now behaves as quo.
* complex.c (nucomp_s_generic_p): has been removed.

	* complex.c (nucomp_to_s): adopts new form.

	* complex.c (nucomp_inspect): ditto.

	* complex.c (string_to_c_internal): ditto and supports polar form.

	* complex.c (rb_complex_polar): new.

	* rational.c (nurat_to_s): did not canonicalize.
	
	* rational.c (nurat_inspect): adopts new form.
	
	* rational.c (string_to_r_internal): ditto.

	* include/ruby/intern.h: added a declaration.

	* lib/complex.rb: added an obsolate class method.

	* lib/cmath.rb: use scalar? instead of generic?.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18778 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-22 12:27:54 +00:00
nobu 5f9c188d97 * include/ruby/ruby.h (rb_intern_const): tiny optimization.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-16 00:20:31 +00:00
tadf c7f4ebc8b7 * complex.c (string_to_c, nucomp_s_convert): preserve the current
backref.

	* rational.c (string_to_r, nurat_s_convert): ditto.

	* include/ruby/intern.h (rb_match_busy): added a declaration.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-13 12:29:50 +00:00
wanabe 6fc17f1f7b * complex.c (string_to_c_internal): save and restore backref. fixed [ruby-dev:34991]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17148 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-13 08:22:13 +00:00
tadf 2b66844f48 * complex.c: refactoring.
* rational.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-12 12:41:17 +00:00
tadf e585bc3c2f * complex.c (nucomp_s_convert): need not to initialize optional
argument for rb_scan_args().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-10 11:56:23 +00:00
tadf 4879ae65fd fixed
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-09 15:13:45 +00:00
tadf a20cf402cf * complex.c (nucomp_s_convert): can accept Complex('i').
[ruby-dev:34991]
	and some minor changes.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17056 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-09 12:02:29 +00:00
nobu 5a647a3f5f * include/ruby/ruby.h (CONST_ID): constant ID cache for non-gcc.
* *.c: no cache in init functions.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-09 09:25:32 +00:00
nobu e39b93b86e * complex.c (make_patterns): constified.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17041 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-09 05:42:04 +00:00
matz f970ffedae * math.c (to_flo): rb_Float() accepts even strings for input.
* complex.c (nucomp_to_f): fix wrong message.

* complex.c (nucomp_to_r): ditto.

* object.c (rb_Float): do not check NaN for error.  NaN is a part
  of valid float values.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16429 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-16 04:17:45 +00:00
nobu f80616b6d2 * complex.c, rational.c: fixed indent.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-22 13:17:04 +00:00
tadf 6d02a4857d * complex.c (nucomp_div): [ruby-dev:34357]
* complex.c (nucomp_abs): use hypot.

	* complex.c (nucomp_quo): do not force convertion.

	* test/ruby/test_complex.rb: omitted some meaningless tests.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-14 22:30:45 +00:00