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

33 Коммитов

Автор SHA1 Сообщение Дата
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
tadf c08b5dfb81 * lib/cmath.rb: new.
* lib/complex.rb: depends lib/cmath.rb.

	* lib/rational.rb: added rdiv.

	* complex.c: removed some math functions.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15906 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-05 14:25:40 +00:00
matz 228f30be3a * bignum.c (Init_Bignum): rdiv method removed. [ruby-dev:34242]
* 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
2008-04-03 16:01:16 +00:00
tadf 5d6602c44e * complex.c (nucomp_int_check): function for DRY real check.
* complex.c (nucomp_{add,sub,mul,div,expt}): use rb_num_coerce_bin().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-03 12:55:27 +00:00
tadf 597179bb95 adopted the ruby's style.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-31 16:42:24 +00:00
matz ef260b085e revert git backfire in r15860; sorry
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-30 15:00:12 +00:00
matz 3730710d79 * proc.c (proc_dup): should copy is_lambda attribute as well.
[ruby-talk:296244]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-30 14:50:55 +00:00
tadf d4f5cb67d4 * complex.c (f_lcm): removed.
* rational.c (rb_lcm, rb_gcdlcm): added.

	* lib/complex.rb (gcd, lcm, gcdlcm): removed.

	* lib/rational.rb (gcd, lcm, gcdlcm): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-27 11:48:00 +00:00
tadf 76865ca0ec trivial changes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-24 13:34:13 +00:00
tadf 6e383d9fa2 fixed. [ruby-dev:34109]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-22 17:31:08 +00:00
mame b9fd3e4e85 * complex.c (nucomp_sub, nucomp_expt): call corresponding functions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15815 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-20 16:41:51 +00:00
tadf 5723a8eeb5 improvements.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-20 12:26:58 +00:00
tadf a3c76eb0c7 added rb_gcd.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15807 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-19 13:29:04 +00:00
tadf 80aa946f91 revert.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15803 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-19 09:37:39 +00:00
nobu 3f5792a1c6 * complex.c (nucomp_to_s, nucomp_inspect): get rid of making
unnecessary intermediate objects.

* complex.c (make_patterns, string_to_c): do not treat successive
  underscores as a part of numeric like as literals.  [ruby-dev:34085]

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


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15800 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-19 05:53:11 +00:00
tadf 073ee17567 edited comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-16 00:51:11 +00:00
tadf 6125552c27 both complex and rational are now builtin classes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-16 00:23:43 +00:00