summaryrefslogtreecommitdiff
path: root/complex.c
AgeCommit message (Collapse)Author
2017-10-19freeze Complex and Rationalnobu
* 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-09-27complex.c: no overflownobu
* 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-27complex.c: no overflownobu
* 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* complex.c: fix Complex#infinite? return value. Because nucomp_abs never ↵nobu
returns negative value. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-21complex.c: remove deprecated functionsnobu
* 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
2016-11-22complex.c: optimize f_gt_p some casesmrkn
* 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-22complex.c: optimize Kernel#Complexmrkn
* 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-18complex.c: optimize f_negatemrkn
* 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-18complex.c: refactoringmrkn
* 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-16complex.c: optimize Numeric#polar and Numeric#argmrkn
* 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-15complex.c: purge id_eqeq_p and limit return valuenobu
* 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-14complex.c: optimizenobu
* 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-13complex.c: refactoringmrkn
* 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-13complex.c: refactoringmrkn
* 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-13complex.c: refactoring and small optimizationmrkn
* 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-13complex.c: refactoringmrkn
* 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-12complex.c: refactoringmrkn
* 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-10-28complex.c: static IDsnobu
* 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-28complex.c: FINITE_TYPE_Pnobu
* 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-24complex.c: undefine Comparable methodsnobu
* 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-24complex.c: undefine clampnobu
* 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-07-29rb_funcallvnobu
* *.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-17numeric.c, complex.c: Add finite? and infinite? consistent with Floatmrkn
* 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-12math.c: Complex sqrtnobu
* 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-12complex.c: rb_complex prefixnobu
* 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-05-18ruby.h: RB_INTEGER_TYPE_Pnobu
* 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-03* complex.c (rb_complex_set_imag): Fix to properly set imagyui-knk
of complex. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-01complex.c don't refer rb_cFixnum and rb_cBignum.akr
* 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-03-31complex.c: pure declarationsnobu
* 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-01-22RUBY_ASSERTnobu
* 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
2015-09-28preserve encodings in error messagesnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-23complex.c: ruby/config.h must be included before math.hodaira
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-07-21ruby/missing.h: M_PI fallback definitionnobu
* 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-05-22* complex.c (f_complex_polar): simple bug reproduced only when y isusa
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-17numeric.c: Numeric#positive? and Numeric#negative?nobu
* 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-03-24* complex.c (k_exact_one_p): remove unused macro k_exact_one_p.gogotanaka
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-24* complex.c (k_inexact_p, k_exact_zero_p): use k_exact_zero_p macrogogotanaka
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-21complex.c: [DOC] mention about Complex literal.gogotanaka
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-09complex.c: suppress warnings on FreeBSDnobu
* 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-02-25complex.c: sign of zerosnobu
* 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-25complex.c: specializenobu
* 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-25complex.c: move optimizationnobu
* 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-25complex.c: M_PI in VCnobu
* 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-24numeric.c: calculate complex numbersnobu
* 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-24complex.c: multiply as rotationnobu
* 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-01-10* complex.c: removed commented-out code.hsbt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-18* internal.h: Gather declarations in non-header files.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-15* internal.h: Include ruby.h and ruby/encoding.h to beakr
includable without prior inclusion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-22provide backward compatibilitiesnobu
* 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-07-28add some documents [ci skip]nobu
* 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