aboutsummaryrefslogtreecommitdiffstats
path: root/complex.c
Commit message (Collapse)AuthorAgeFilesLines
* rb_funcallvnobu2016-07-291-2/+2
| | | | | | | * *.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
* numeric.c, complex.c: Add finite? and infinite? consistent with Floatmrkn2016-07-171-0/+65
| | | | | | | | | | | | | | | | | | | | | | * 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
* math.c: Complex sqrtnobu2016-07-121-12/+22
| | | | | | | * 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
* complex.c: rb_complex prefixnobu2016-07-121-4/+4
| | | | | | | * 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
* ruby.h: RB_INTEGER_TYPE_Pnobu2016-05-181-2/+2
| | | | | | | | * 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
* * complex.c (rb_complex_set_imag): Fix to properly set imagyui-knk2016-05-031-1/+1
| | | | | | of complex. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* complex.c don't refer rb_cFixnum and rb_cBignum.akr2016-05-011-2/+2
| | | | | | | | | | * 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
* complex.c: pure declarationsnobu2016-03-311-5/+2
| | | | | | | * 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
* RUBY_ASSERTnobu2016-01-221-1/+1
| | | | | | | * 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
* preserve encodings in error messagesnobu2015-09-281-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* complex.c: ruby/config.h must be included before math.hodaira2015-09-231-0/+1
| | | | | | | | 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
* ruby/missing.h: M_PI fallback definitionnobu2015-07-211-1/+1
| | | | | | | * 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
* * complex.c (f_complex_polar): simple bug reproduced only when y isusa2015-05-221-1/+1
| | | | | | | 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
* numeric.c: Numeric#positive? and Numeric#negative?nobu2015-05-171-0/+3
| | | | | | | | | | | | * 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
* * complex.c (k_exact_one_p): remove unused macro k_exact_one_p.gogotanaka2015-03-241-1/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c (k_inexact_p, k_exact_zero_p): use k_exact_zero_p macrogogotanaka2015-03-241-5/+4
| | | | | | to remove k_inexact_p macro. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* complex.c: [DOC] mention about Complex literal.gogotanaka2015-03-211-2/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* complex.c: suppress warnings on FreeBSDnobu2015-03-091-2/+2
| | | | | | * 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
* complex.c: sign of zerosnobu2015-02-251-12/+26
| | | | | | | * 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
* complex.c: specializenobu2015-02-251-11/+9
| | | | | | | * 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
* complex.c: move optimizationnobu2015-02-251-29/+40
| | | | | | | * 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
* complex.c: M_PI in VCnobu2015-02-251-0/+4
| | | | | | | * 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
* numeric.c: calculate complex numbersnobu2015-02-241-4/+6
| | | | | | | * 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
* complex.c: multiply as rotationnobu2015-02-241-0/+35
| | | | | | | * 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
* * complex.c: removed commented-out code.hsbt2015-01-101-4/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h: Gather declarations in non-header files.akr2014-11-181-2/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h: Include ruby.h and ruby/encoding.h to beakr2014-11-151-1/+0
| | | | | | | | includable without prior inclusion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* provide backward compatibilitiesnobu2014-08-221-0/+2
| | | | | | | | | * 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
* add some documents [ci skip]nobu2014-07-281-1/+1
| | | | | | | | | | | | | | | * 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
* * include/ruby/ruby.h (struct RComplex): no longer. [Feature #9888]shyouhei2014-06-231-0/+14
| | | | | | | | | | | | | | | | | | | | * 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
* avoid large alloca on Complex/Rational callsnormal2014-05-021-8/+15
| | | | | | | | * 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
* * complax.c: [DOC] Document number conversion of `nil` by @skade [fix ↵hsbt2014-03-211-0/+2
| | | | | | | | 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
* complex.c: remove f_inspect and f_to_snobu2014-03-171-23/+14
| | | | | | | | | | | * 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
* unused functions and variablesnobu2014-03-171-58/+6
| | | | | | | | | | | | * 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
* * complex.c: removed meaningless lines.tadf2013-09-151-2/+0
| | | | | | | * rational.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rational.c: conditionally defined variablenobu2013-09-101-0/+2
| | | | | | | * 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
* complex.c: fix typonobu2013-09-091-4/+4
| | | | | | * 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
* complex.c, rational.c: use RB_TYPE_Pnobu2013-09-091-49/+27
| | | | | | | * 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
* * gc.c: support RGENGC. [ruby-trunk - Feature #8339]ko12013-05-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* * include/ruby/ruby.h: constify RRational::(num,den) andko12013-05-131-4/+4
| | | | | | | | | | | | | | | | | 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
* * *.c, parse.y, insns.def: use RARRAY_AREF/ASET macroko12013-05-131-2/+2
| | | | | | | | instead of using RARRAY_PTR(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c: Document synonymous methods, by windwiny [GH-277]zzak2013-04-121-0/+1
| | | | | | | | | | | | | | | * 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
* * complex.c: edited rdoc.tadf2013-03-101-1/+7
| | | | | | | * rational.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c: described syntax of string form.tadf2013-03-101-0/+18
| | | | | | | * rational.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* marshal.c: marshal_dump instance varialbesnobu2013-01-261-0/+1
| | | | | | | | | * 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
* complex.c, time.c: make marshal methods privatenobu2012-12-011-2/+2
| | | | | | | | * 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
* * complex.c (string_to_c_strict, string_to_c): check NUL.tadf2012-11-221-3/+21
| | | | | | | * 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
* * complex.c (nucomp_to_c): added.tadf2012-11-211-0/+16
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c: some improvements.tadf2012-11-201-11/+29
| | | | | | | * rational.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c (read_comp): mathn compliant.tadf2012-11-181-8/+8
| | | | | | | * rational.c (read_num): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37708 b2dd03c8-39d4-4d8f-98ff-823fe69b080e