summaryrefslogtreecommitdiff
path: root/complex.c
AgeCommit message (Collapse)Author
2014-05-02avoid large alloca on Complex/Rational callsnormal
* 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-03-21* complax.c: [DOC] Document number conversion of `nil` by @skade [fix ↵hsbt
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-17complex.c: remove f_inspect and f_to_snobu
* 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-17unused functions and variablesnobu
* 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
2013-09-15 * complex.c: removed meaningless lines.tadf
* rational.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-10rational.c: conditionally defined variablenobu
* 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-09complex.c: fix typonobu
* 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-09complex.c, rational.c: use RB_TYPE_Pnobu
* 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-05-13* gc.c: support RGENGC. [ruby-trunk - Feature #8339]ko1
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* include/ruby/ruby.h: constify RRational::(num,den) andko1
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* *.c, parse.y, insns.def: use RARRAY_AREF/ASET macroko1
instead of using RARRAY_PTR(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-12* array.c: Document synonymous methods, by windwiny [GH-277]zzak
* 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-03-10 * complex.c: edited rdoc.tadf
* rational.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-10 * complex.c: described syntax of string form.tadf
* rational.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-26marshal.c: marshal_dump instance varialbesnobu
* 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
2012-12-01complex.c, time.c: make marshal methods privatenobu
* 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-11-22 * complex.c (string_to_c_strict, string_to_c): check NUL.tadf
* 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-21 * complex.c (nucomp_to_c): added.tadf
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-20 * complex.c: some improvements.tadf
* rational.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-18 * complex.c (read_comp): mathn compliant.tadf
* rational.c (read_num): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37708 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-18trivial changes.tadf
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-17 * complex.c (read_comp): modified handling of polar form.tadf
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37705 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-17 * complex.c (read_comp): fixed handling of polar form.tadf
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37704 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-17 * complex.c (string_to_c_strict, string_to_c): rewrote without regexp.tadf
* 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 * complex.c (make_patterns): should not accept extra sign.tadf
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-10 * complex.c: modified doc.tadf
* ratioanl.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-03 * complex.c: modified doc.tadf
* rational.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37460 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-20* include/ruby/ruby.h: add C APIs.nari
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-09-22* complex.c: Fix examples of r36993.eregon
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-20remove garbages.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-19* complex.c: Examples for Complex Documentation.zzak
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-08-04added a commenttadf
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-25complex.c, rational.c: compatible marshal loadernobu
* 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-06-03 * marshal.c: experimental test aborted.tadf
* 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 * marshal.c: calls directly rb_{Complex,Rational}_marshal_load().tadf
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-03use rb_marshal_{dump,load}nobu
* 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 * complex.c: wrote Complex#_dump and Complex::load. But nowtadf
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 * complex.c (nucomp_marshal_load): [ruby-core:45394]tadf
* rational.c (nurat_marshal_load): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-08 * complex.c (nucomp_expt): [ruby-core:44170].tadf
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35265 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-08* complex.c (nucomp_expt): the result of f_complex_new2 may be a fixnumnaruse
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-02-28replaced rdoc for Complex::Itadf
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-25* complex.c (nucomp_marshal_load): raise error on invalid data.naruse
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-24* complex.c (Init_Complex): Document Complex::I. Patch by Sylvaindrbrain
Daubert. [Feature #5623] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34778 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-02* complex.c (nucomp_rationalize): fix function. [ruby-core:40667]nobu
[Bug #5546] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33613 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-24* complex.c: use "__sun" instead of "__sun__" to detect SunOS.akr
* math.c: ditto. * hash.c: ditto. * atomic.h: ditto. * ext/io/wait/wait.c: ditto. [ruby-dev:44693] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-29* use RB_TYPE_P which is optimized for constant types, instead ofnobu
comparison with TYPE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-10* complex.c (nucomp_rationalize): calls rationalize of real part ifmrkn
imaginary part is exactly zero. The patch is made by Marc-Andre Lafortune. fixes [Bug #5178] [ruby-core:38885] * test/ruby/test_complex.rb (test_rationalize): add a test for the above change. * complex.c (nucomp_to_r): fix RDoc comment. The patch is made by Marc-Andre Lafortune. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-05* complex.c (f_signbit): fix compile error in gcc4 on Solaris withngoto
CFLAGS="-std=gnu99". [ruby-dev:44355] fix [Bug #5159] * math.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-31Forward-ports r32777 from branches/ruby_1_9_3 to trunk.yugui
-- * complex.c (f_signbit): gcc4 on Solaris DOES have signbit but does not have it on header. * math.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-09 * internal.h: added declarations.tadf
* complex.c: followed the above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32475 b2dd03c8-39d4-4d8f-98ff-823fe69b080e