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

278 Коммитов

Автор SHA1 Сообщение Дата
mrkn c225d3c9b5 complex.c, rational.c: remove dead code
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-24 15:06:07 +00:00
nobu 16ef24ac08 [DOC] nodoc internal methods/classes
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-23 02:16:42 +00:00
nobu 3f7221ad3d force fixable
* complex.c (nucomp_hash): force hash values fixable.
  [ruby-core:85224] [Bug #14420]

* rational.c (nurat_hash): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62107 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-30 05:48:28 +00:00
kazu b8cc476ce9 use predefined IDs
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-22 13:09:37 +00:00
stomar 3d58c86f64 complex.c: doc fix
* complex.c: [DOC] fix grammar and typo.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60569 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-29 20:50:55 +00:00
nobu 42c98194b3 freeze Complex and Rational
* complex.c (nucomp_s_new_internal, nucomp_loader): Complex
  instances are always frozen now.  [Feature #13983]

* rational.c (nurat_s_new_internal, nurat_loader): Rational
  instances are always frozen now.  [Feature #13983]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-19 10:58:08 +00:00
nobu 65d7479920 complex.c: no overflow
* complex.c (rb_complex_infinite_p): get rid of overflow and
  unnecessary multiplication.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60041 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-27 02:55:03 +00:00
nobu 241ba38d70 complex.c: no overflow
* complex.c (rb_complex_finite_p): get rid of overflow and
  unnecessary multiplication.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-27 02:38:51 +00:00
nobu ea5e91b51f * complex.c: fix Complex#infinite? return value. Because nucomp_abs never returns negative value.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-27 01:01:26 +00:00
nobu f4c2b33eac complex.c: remove deprecated functions
* complex.c (rb_complex_set_real, rb_complex_set_imag): remove
  functions deprecated at 2.2.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-21 06:07:21 +00:00
mrkn b920d9545c complex.c: optimize f_gt_p some cases
* complex.c (f_gt_p): optimize f_gt_p for specific types of arguments.

* internal.h (rb_int_gt, rb_float_gt, rb_rational_cmp): exported.

* numeric.c (rb_float_gt): rename from flo_gt and be exported.

* numeric.c (rb_int_gt): rename from int_gt and be exported.

* rational.c (rb_rational_cmp): rename from nurat_cmp and be exported.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-22 05:21:12 +00:00
mrkn 5a5cc211f4 complex.c: optimize Kernel#Complex
* complex.c (nucomp_f_complex): use nucomp_s_convert directly.

* complex.c (id_convert): removed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-22 04:54:57 +00:00
mrkn c151aa88a9 complex.c: optimize f_negate
* complex.c (f_negate): optimize for special numeric types.

* complex.c (nucomp_expt): use rb_int_uminus instead of f_negate for
  fixnum value.

* internal.h (rb_float_uminus, rb_rational_uminus): exported.

* numeric.c (rb_float_uminus): rename from flo_uminus.

* rational.c (rb_rational_uminus): rename from nurat_negate, and add
  assertion for the parameter.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-18 15:17:19 +00:00
mrkn a94b625ff2 complex.c: refactoring
* complex.c (nucomp_abs): use rb_math_hypot directly.

* complex.c (nucomp_arg): use rb_math_atan2 directly.

* complex.c (imp2, m_{atan2,hypot}_bang, m_hypot): removed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-18 14:24:15 +00:00
mrkn affa0f845c complex.c: optimize Numeric#polar and Numeric#arg
* complex.c (numeric_polar): optimize for Integer, Float, and Rational.

* complex.c (numeric_arg): directly create the value of pi.

* complex.c (f_negative_p): optimize for Integer, Float, and Rational.

* rational.c (INT_NEGATIVE_P): move the definition into internal.h.

* internal.h (INT_NEGATIVE_P): ditto.

* numeric.c (rb_float_abs): rename from flo_abs and export to be used
  from other source files..

* internal.h (rb_float_abs): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56809 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-16 04:25:35 +00:00
nobu c4e660457f complex.c: purge id_eqeq_p and limit return value
* complex.c (f_eqeq_p): use rb_equal.

* complex.c (nucomp_eqeq_p): limit return value to true or false,
  instead of the result of the other as-is.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56797 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-15 06:28:05 +00:00
nobu c0af2a1641 complex.c: optimize
* complex.c (f_negative_p): use rb_num_negative_p instead of funcall.

* complex.c (f_kind_of_p, f_numeric_p): cast down to int because
  rb_obj_is_kind_of is safe.

* complex.c (f_signbit, f_tpositive_p): remove f_boolcast.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56776 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-14 04:06:15 +00:00
mrkn 975e0ef858 complex.c: refactoring
* complex.c (f_zero_p): return int rather than VALUE.

* complex.c (rb_complex_mul): remove needless negate operations.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-13 16:43:43 +00:00
mrkn 7c451099f5 complex.c: refactoring
* complex.c (f_one_p): removed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56771 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-13 16:22:26 +00:00
mrkn 912857340b complex.c: refactoring and small optimization
* complex.c (nucomp_expt): optimize the access to the numerator and
  denominator of a rational number.

* complex.c (k_rational_p): removed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-13 16:22:08 +00:00
mrkn 9e20ee9081 complex.c: refactoring
* complex.c (f_addsub, k_complex_p, k_float_p): removed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-13 16:21:54 +00:00
mrkn b027b019ef complex.c: refactoring
* complex.c: refactor to use some specific macros and
  to reduce needless conversion by FIX2LONG.

* complex.c (k_fixnum_p, k_bignum_p): removed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56762 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 18:42:30 +00:00
nobu b03a92c4ce complex.c: static IDs
* complex.c (id_finite_p, id_infinite_p, id_rationalize, id_PI):
  initialize static IDs.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-28 06:20:19 +00:00
nobu 2226372268 complex.c: FINITE_TYPE_P
* complex.c (FINITE_TYPE_P): extract predicate.
* complex.c (rb_complex_finite_p, rb_complex_infinite_p): use
  dedicated predicates instead of switch by TYPE.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-28 06:19:00 +00:00
nobu 052690309a complex.c: undefine Comparable methods
* complex.c (Init_Complex): undefine methods inherited from
  Comparable, because Complex does not have <=> method.
  [Bug #12866]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56483 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-24 01:51:10 +00:00
nobu 7a9812209d complex.c: undefine clamp
* complex.c (Init_Complex): undefine Complex#clamp, which does not
  work like other Comparable methods, because Complex does not
  have <=> method.  patched by Tim Peters <zomg.tim AT gmail.com>
  in [ruby-core:77720].  [Bug #12866]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56479 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-24 01:19:46 +00:00
nobu c463366dfd rb_funcallv
* *.c: rename rb_funcall2 to rb_funcallv, except for extensions
  which are/will be/may be gems.  [Fix GH-1406]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55773 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-29 11:57:14 +00:00
mrkn 94468b4ea5 numeric.c, complex.c: Add finite? and infinite? consistent with Float
* numeric.c (num_finite_p, num_infinite_p): Add Numeric#finite? and
  Numeric#infinite?  [Feature #12039] [ruby-core:73618]

* complex.c (rb_complex_finite_p): Add Complex#finite?

* complex.c (rb_complex_infinite_p): Add Complex#infinite?

* test/ruby/test_bignum.rb: Add test for Integer#finite? and
  Integer#infinite?

* test/ruby/test_fixnum.rb: ditto.

* test/ruby/test_rational.rb: Add test for Rational#finite? and
  Rational#infinite?

* test/ruby/test_complex.rb: Add test for Complex#finite? and
  Complex#infinite?

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55702 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-17 14:53:00 +00:00
nobu 745a2aac69 math.c: Complex sqrt
* math.c (rb_math_sqrt): [EXPERIMENTAL] move Complex sqrt support
  from mathn.rb.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-12 14:13:46 +00:00
nobu 89ed4f41a3 complex.c: rb_complex prefix
* complex.c (rb_complex_plus, rb_complex_mul): rename to
  rb_complex prefix.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-12 13:17:04 +00:00
nobu 4a9705d6e3 ruby.h: RB_INTEGER_TYPE_P
* include/ruby/ruby.h (RB_INTEGER_TYPE_P): new macro and
  underlying inline function to check if the object is an
  Integer (Fixnum or Bignum).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-18 01:17:43 +00:00
yui-knk c949686d02 * complex.c (rb_complex_set_imag): Fix to properly set imag
of complex.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-03 13:54:19 +00:00
akr f1183cb910 complex.c don't refer rb_cFixnum and rb_cBignum.
* complex.c: Don't refer rb_cFixnum and rb_cBignum.
  (k_fixnum_p): Use FIXNUM_P.
  (k_bignum_p): Use RB_TYPE_P.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54878 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-01 21:59:41 +00:00
nobu 7d5b9cd3f6 complex.c: pure declarations
* complex.c (get_dat1, get_dat2): turn into pure variable
  declarations only, not mixed code and declarations.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54446 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-31 03:02:35 +00:00
nobu 439224a590 RUBY_ASSERT
* error.c (rb_assert_failure): assertion with stack dump.
* ruby_assert.h (RUBY_ASSERT): new header for the assertion.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53615 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-22 08:33:55 +00:00
nobu 4191a6b90d preserve encodings in error messages
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-28 02:40:46 +00:00
odaira c3b02d572c complex.c: ruby/config.h must be included before math.h
because it defines _LARGE_FILES on AIX and _LARGE_FILES
must be defined before sys/types.h is included from math.h.
[Bug #11483]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-23 15:08:47 +00:00
nobu 42e36319bd ruby/missing.h: M_PI fallback definition
* include/ruby/missing.h (M_PI, M_PI_2): fallback definitions for
  VC6.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51313 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-21 10:51:40 +00:00
usa b53d547f38 * complex.c (f_complex_polar): simple bug reproduced only when y is
a float but x is not a float.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50601 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-22 11:57:43 +00:00
nobu 932e916b9e numeric.c: Numeric#positive? and Numeric#negative?
* numeric.c (num_positive_p, num_negative_p): add methods
  Numeric#positive? and Numeric#negative?.
  [ruby-core:69173] [Feature #11151]
* numeric.c (flo_positive_p, flo_negative_p): specialiazed
  functions for Float.
* complex.c (Init_Complex): Complex do not have positive? and
  negative? methods

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-17 06:01:47 +00:00
gogotanaka cf204a8943 * complex.c (k_exact_one_p): remove unused macro k_exact_one_p.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-24 21:59:55 +00:00
gogotanaka c959238445 * complex.c (k_inexact_p, k_exact_zero_p): use k_exact_zero_p macro
to remove k_inexact_p macro.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-24 21:59:36 +00:00
gogotanaka 9f2922bdcd complex.c: [DOC] mention about Complex literal.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-21 12:32:09 +00:00
nobu f8a82e1583 complex.c: suppress warnings on FreeBSD
* complex.c (safe_mul): get rid of assignments in a macro.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-09 05:48:09 +00:00
nobu 41b2f1ada4 complex.c: sign of zeros
* complex.c (rb_nucomp_mul): preserve sign of zeros without NaN by
  regularized values.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-25 17:05:26 +00:00
nobu 909c4c0fd7 complex.c: specialize
* complex.c (rb_nucomp_mul): specialize real numbers and purely
  imaginary numbers, and get rid of multiplication by zero.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-25 14:16:05 +00:00
nobu ca3f71b8b5 complex.c: move optimization
* complex.c (f_complex_polar): move optimization for orthogonal
  cases from rb_nucomp_mul.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-25 06:48:55 +00:00
nobu 7b65fb292a complex.c: M_PI in VC
* complex.c (_USE_MATH_DEFINES): needed for M_PI in Microsoft
  Visual C.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49732 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-25 02:25:22 +00:00
nobu ed00379c79 numeric.c: calculate complex numbers
* numeric.c (fix_plus, fix_mul): calculate complex numbers for
  commutative operations.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49724 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-24 13:59:06 +00:00
nobu 3bcb10ad2a complex.c: multiply as rotation
* complex.c (nucomp_mul): calculate as rotation in complex plane
  if matrix calculation resulted in NaN.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-24 13:58:52 +00:00
hsbt 847461260f * complex.c: removed commented-out code.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-10 01:58:59 +00:00
akr 2b9191e557 * internal.h: Gather declarations in non-header files.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-18 15:13:05 +00:00
akr 7cd76ab0c5 * internal.h: Include ruby.h and ruby/encoding.h to be
includable without prior inclusion.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-15 11:49:06 +00:00
nobu 9261f25e0f provide backward compatibilities
* complex.c (Init_Complex): provide the feature for backward
  compatibility.

* rational.c (Init_Rational): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47249 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-22 08:01:42 +00:00
nobu aa3b506270 add some documents [ci skip]
* bignum.c (Init_Bignum): [DOC] Bignum::GMP_VERSION.

* complex.c (Init_Complex): [DOC] ignore an internal class.

* dir.c (Init_Dir): [DOC] File::FNM_SYSCASE.

* file.c (rb_file_exists_p): [DOC] File.exists? is deprecated.

* object.c (rb_mod_initialize_clone): [DOC] ignore implementation
  detail.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-28 11:28:55 +00:00
shyouhei 62bfc4f24e * include/ruby/ruby.h (struct RComplex): no longer. [Feature #9888]
* include/ruby/ruby.h (RCOMPLEX): ditto.

	* include/ruby/ruby.h (RCOMPLEX_SET_REAL): deprecated.  Will be deleted later.

	* include/ruby/ruby.h (RCOMPLEX_SET_IMAG): ditto.

	* internal.h (struct RFloat): moved here.

	* internal.h (RCOMPLEX): ditto.

	* complex.c (rb_complex_set_real): do not use this.

	* complex.c (rb_complex_set_imag): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-23 04:41:27 +00:00
normal a9befcdb08 avoid large alloca on Complex/Rational calls
* complex.c (parse_comp): replace ALLOCA_N with ALLOCV_N/ALLOCV_END
  [Bug #9608]
* rational.c (read_digits): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45793 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-02 19:21:18 +00:00
hsbt cbf4eca61e * complax.c: [DOC] Document number conversion of `nil` by @skade [fix GH-570] [ci skip]
* object.c, rational.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45375 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-21 00:45:52 +00:00
nobu 77f3da02a0 complex.c: remove f_inspect and f_to_s
* complex.c (nucomp_to_s): use rb_String.

* complex.c (nucomp_inspect): use rb_inspect.

* complex.c: use PRIsVALUE flag not to use an intermediate string
  which can be collected by GC.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-17 04:57:17 +00:00
nobu 6224216294 unused functions and variables
* complex.c, rational.c: remove unused functions, which are warned
  by clang 5.1, and also variables only used by removed functions.

* ext/date/date_core.c: ditto.

* enc/utf_16be.c, enc/utf_16le.c: comment out constants only used
  by commented out functions.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-17 04:57:14 +00:00
tadf bb82e49632 * complex.c: removed meaningless lines.
* rational.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-15 22:34:27 +00:00
nobu 9c060a59b4 rational.c: conditionally defined variable
* rational.c (numeric_quo): variable 'canonicalization' is defined
  conditionally by CANON (and CANONICALIZATION_FOR_MATHN).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-10 05:05:50 +00:00
nobu d968e9ecfa complex.c: fix typo
* complex.c (nucomp_real_check): fix a variable name.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42895 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-09 05:47:47 +00:00
nobu 2b5c2ebfbf complex.c, rational.c: use RB_TYPE_P
* complex.c, rational.c: use RB_TYPE_P() for special classes instead
  of switch with TYPE().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-09 05:17:13 +00:00
ko1 4f401816ff * gc.c: support RGENGC. [ruby-trunk - Feature #8339]
See this ticet about RGENGC.
* gc.c: Add several flags:
* RGENGC_DEBUG: if >0, then prints debug information.
* RGENGC_CHECK_MODE: if >0, add assertions.
* RGENGC_PROFILE: if >0, add profiling features.
  check GC.stat and GC::Profiler.
* include/ruby/ruby.h: disable RGENGC by default (USE_RGENGC == 0).
* array.c: add write barriers for T_ARRAY and generate sunny objects.
* include/ruby/ruby.h (RARRAY_PTR_USE): added. Use this macro if
  you want to access raw pointers. If you modify the contents which
  pointer pointed, then you need to care write barrier.
* bignum.c, marshal.c, random.c: generate T_BIGNUM sunny objects.
* complex.c, include/ruby/ruby.h: add write barriers for T_COMPLEX
  and generate sunny objects.
* rational.c (nurat_s_new_internal), include/ruby/ruby.h: add write
  barriers for T_RATIONAL and generate sunny objects.
* internal.h: add write barriers for RBasic::klass.
* numeric.c (rb_float_new_in_heap): generate sunny T_FLOAT objects.
* object.c (rb_class_allocate_instance), range.c:
  generate sunny T_OBJECT objects.
* string.c: add write barriers for T_STRING and generate sunny objects.
* variable.c: add write barriers for ivars.
* vm_insnhelper.c (vm_setivar): ditto.
* include/ruby/ruby.h, debug.c: use two flags
  FL_WB_PROTECTED and FL_OLDGEN.
* node.h (NODE_FL_CREF_PUSHED_BY_EVAL, NODE_FL_CREF_OMOD_SHARED):
  move flag bits.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 18:07:47 +00:00
ko1 89e6910f04 * include/ruby/ruby.h: constify RRational::(num,den) and
RComplex::(real,imag).
  Add macro to set these values:
* RRATIONAL_SET_NUM()
* RRATIONAL_SET_DEN()
* RCOMPLEX_SET_REAL()
* RCOMPLEX_SET_IMAG()
  This change is a part of RGENGC branch [ruby-trunk - Feature #8339].
  TODO: API design. RRATIONAL_SET(rat,num,den) is enough?
  TODO: Setting constify variable with cast has same issue of r40691.
* complex.c, rational.c: use above macros.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40698 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 15:55:09 +00:00
ko1 aacd771046 * *.c, parse.y, insns.def: use RARRAY_AREF/ASET macro
instead of using RARRAY_PTR().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 09:56:22 +00:00
zzak 9ef4e13459 * array.c: Document synonymous methods, by windwiny [GH-277]
* bignum.c: ditto
* complex.c: ditto
* dir.c: ditto
* encoding.c: ditto
* enumerator.c: ditto
* numeric.c: ditto
* proc.c: ditto
* re.c: ditto
* string.c: ditto


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-12 02:59:07 +00:00
tadf 9a4f037502 * complex.c: edited rdoc.
* rational.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-10 08:01:32 +00:00
tadf ec9eabc6c2 * complex.c: described syntax of string form.
* rational.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-10 00:18:52 +00:00
nobu 3d0786a3a8 marshal.c: marshal_dump instance varialbes
* marshal.c (w_object): dump instance varialbes of the result of
  marshal_dump not the original object.  [ruby-core:51163] [Bug #7627]
* complex.c (nucomp_marshal_dump): need to copy instance variables.
* rational.c (nurat_marshal_dump): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-26 13:39:15 +00:00
nobu 9c1b3161f2 complex.c, time.c: make marshal methods private
* complex.c (Init_Complex), time.c (Init_Time): make marshal methods
  private.  [Feature #6539]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38115 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-01 09:17:02 +00:00
tadf d6ec400148 * complex.c (string_to_c_strict, string_to_c): check NUL.
* rational.c (string_to_r_strict, string_to_r): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-22 11:32:52 +00:00
tadf 4d03af3d9c * complex.c (nucomp_to_c): added.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-21 12:54:06 +00:00
tadf 21453dc738 * complex.c: some improvements.
* rational.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-20 12:10:08 +00:00
tadf 42d38decda * complex.c (read_comp): mathn compliant.
* rational.c (read_num): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37708 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-18 00:35:06 +00:00
tadf 7a1985a969 trivial changes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-18 00:26:15 +00:00
tadf 62f7e108e2 * complex.c (read_comp): modified handling of polar form.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37705 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-17 17:03:52 +00:00
tadf 8d05671d63 * complex.c (read_comp): fixed handling of polar form.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37704 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-17 15:51:55 +00:00
tadf 47fe9b79a3 * complex.c (string_to_c_strict, string_to_c): rewrote without regexp.
* rational.c (string_to_r_strict, string_to_r): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37702 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-17 15:19:55 +00:00
tadf 20039668dd * complex.c (make_patterns): should not accept extra sign.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-17 14:57:22 +00:00
tadf e864787c84 * complex.c: modified doc.
* ratioanl.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-10 10:29:13 +00:00
tadf d4199057bc * complex.c: modified doc.
* rational.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37460 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-03 14:39:50 +00:00
nari c3a46d6aca * include/ruby/ruby.h: add C APIs.
VALUE rb_newobj_of(VALUE klass, VALUE flags)
  #define NEWOBJ_OF(obj,type,klass,flags)
  These allow to change a allocation strategy depending on klass
  or flags.

* gc.c: ditto

* array.c: use new C API.
* bignum.c: ditto
* class.c: ditto
* complex.c: ditto
* ext/socket/ancdata.c: ditto
* ext/socket/option.c: ditto
* hash.c: ditto
* io.c: ditto
* marshal.c: ditto
* numeric.c: ditto
* object.c: ditto
* random.c: ditto
* range.c: ditto
* rational.c: ditto
* re.c: ditto
* string.c: ditto
* struct.c: ditto
  [Feature #7177][Feature #7047]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-20 06:57:51 +00:00
eregon 63f6cda815 * complex.c: Fix examples of r36993.
Keep the simple definition, mathematics define the result.
  Based on patch by Robin Dupret. Fixes #188 on github.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-22 17:36:47 +00:00
nobu 2b64e10feb remove garbages.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-20 07:06:06 +00:00
zzak 7c4d0468df * complex.c: Examples for Complex Documentation.
Patch by Robin Dupret.
  Fixes #184 on github.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36993 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-19 22:23:15 +00:00
tadf a2c5d15572 added a comment
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-04 22:04:20 +00:00
nobu 003c45f9cd complex.c, rational.c: compatible marshal loader
* complex.c, rational.c: compatible marshal loader for compatibilities
  with 1.8.  [ruby-core:45775] [Bug #6625]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36538 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-25 08:41:07 +00:00
tadf eb6579e647 * marshal.c: experimental test aborted.
* complex.c: ditto.
	* rational.c: ditto.
	* include/ruby/intern.h: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-03 19:26:58 +00:00
tadf f5b06413ca * marshal.c: calls directly rb_{Complex,Rational}_marshal_load().
But now disabled. [experimental]
	* complex.c: followed the above.
	* rational.c: ditto.
	* include/rub/intern.h: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35886 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-03 12:21:18 +00:00
nobu 694035eb35 use rb_marshal_{dump,load}
* marshal.c: revert r35879 "now marshal_{load|dump} are external."
* complex.c (nucomp_marshal__{dump,load}): should use rb_marshal_{dump,load}.
* rational.c (nurat_marshal__{dump,load}): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35881 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-03 07:34:03 +00:00
tadf bdc55aa0c6 * complex.c: wrote Complex#_dump and Complex::load. But now
disabled (due to compatibility) [experimental].

	* rational.c: wrote Rational#_dump and Rational::load. ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35877 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-03 05:05:29 +00:00
tadf 89ae71d721 * complex.c (nucomp_marshal_load): [ruby-core:45394]
* rational.c (nurat_marshal_load): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-03 01:26:41 +00:00
tadf 08df821865 * complex.c (nucomp_expt): [ruby-core:44170].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35265 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-08 22:00:32 +00:00
naruse 71d114297f * complex.c (nucomp_expt): the result of f_complex_new2 may be a fixnum
with mathn. [ruby-core:44170] [Bug #6267]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-08 17:53:51 +00:00
tadf 329ae7470e replaced rdoc for Complex::I
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-28 21:53:54 +00:00
naruse eeff98c430 * complex.c (nucomp_marshal_load): raise error on invalid data.
reported by John Firebaugh [ruby-core:42860] [Bug #6076]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34803 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-25 07:20:00 +00:00
drbrain af9398ab38 * complex.c (Init_Complex): Document Complex::I. Patch by Sylvain
Daubert.  [Feature #5623]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34778 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-24 00:10:53 +00:00
nobu 292b3e4113 * complex.c (nucomp_rationalize): fix function. [ruby-core:40667]
[Bug #5546]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33613 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-02 12:36:06 +00:00