summaryrefslogtreecommitdiff
path: root/complex.c
Commit message (Collapse)AuthorAgeFilesLines
* [DOC] Fix broken links to literals.rdocNobuyoshi Nakada2022-02-081-1/+1
|
* [DOC] Simplify links to global methodsNobuyoshi Nakada2022-02-081-1/+1
|
* Adding links to literals and Kernel (#5192)Burdette Lamar2021-12-031-0/+8
| | | | * Adding links to literals and Kernel
* Remove declarations unused since a95262356ef5Nobuyoshi Nakada2021-10-181-2/+0
|
* Refactor and Using RBOOL macroS.H2021-09-151-4/+1
|
* Using RB_BIGNUM_TYPE_P macroS-H-GAMELINKS2021-09-111-1/+1
|
* include/ruby/internal/intern/complex.h: add doxygen卜部昌平2021-09-101-7/+0
| | | | Must not be a bad idea to improve documents. [ci skip]
* Remove unneeded commentS-H-GAMELINKS2021-09-031-8/+0
|
* Extract always_finite_type_p and handle flonum casesNobuyoshi Nakada2021-09-021-4/+12
|
* Make internal predicate functions to return simple booleanNobuyoshi Nakada2021-09-021-9/+6
|
* Refactor f_infinite_p functionS-H-GAMELINKS2021-09-021-4/+1
|
* Use C99-defined signbit macroNobuyoshi Nakada2021-08-271-4/+0
|
* Replace f_boolcast with RBOOL macroS.H2021-08-181-6/+4
| | | | | | | * Move f_boolcast definination * Remove f_boolcast macro defination * to
* Rename nucomp_false s nucomp_real_p_mNobuyoshi Nakada2021-05-201-2/+2
|
* cdhash_cmp: can also take complex卜部昌平2021-05-121-3/+9
| | | | There are complex literals `123i`, which can also be a case condition.
* Remove duplicated float_arg definationS-H-GAMELINKS2021-03-191-2/+0
|
* Follow the NDEBUG given to the wholeNobuyoshi Nakada2021-01-071-2/+0
|
* Removed canonicalization for mathnNobuyoshi Nakada2020-11-101-21/+0
|
* Don't redefine #rb_intern over and over againStefan Stüben2020-10-211-14/+11
|
* Fix assertion failed in Complex.polar without NDEBUG (#3551)Kenta Murata2020-09-161-0/+8
| | | Fixes [Bug #17172].
* RARRAY_AREF: convert into an inline function卜部昌平2020-08-151-0/+1
| | | | | | RARRAY_AREF has been a macro for reasons. We might not be able to change that for public APIs, but why not relax the situation internally to make it an inline function.
* Ensure origins for all included, prepended, and refined modulesJeremy Evans2020-06-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes various issues when a module is included in or prepended to a module or class, and then refined, or refined and then included or prepended to a module or class. Implement by renaming ensure_origin to rb_ensure_origin, making it non-static, and calling it when refining a module. Fix Module#initialize_copy to handle origins correctly. Previously, Module#initialize_copy did not handle origins correctly. For example, this code: ```ruby module B; end class A def b; 2 end prepend B end a = A.dup.new class A def b; 1 end end p a.b ``` Printed 1 instead of 2. This is because the super chain for a.singleton_class was: ``` a.singleton_class A.dup B(iclass) B(iclass origin) A(origin) # not A.dup(origin) ``` The B iclasses would not be modified, so the includer entry would be still be set to A and not A.dup. This modifies things so that if the class/module has an origin, all iclasses between the class/module and the origin are duplicated and have the correct includer entry set, and the correct origin is created. This requires other changes to make sure all tests still pass: * rb_undef_methods_from doesn't automatically handle classes with origins, so pass it the origin for Comparable when undefing methods in Complex. This fixed a failure in the Complex tests. * When adding a method, the method cache was not cleared correctly if klass has an origin. Clear the method cache for the klass before switching to the origin of klass. This fixed failures in the autoload tests related to overridding require, without breaking the optimization tests. Also clear the method cache for both the module and origin when removing a method. * Module#include? is fixed to skip origin iclasses. * Refinements are fixed to use the origin class of the module that has an origin. * RCLASS_REFINED_BY_ANY is removed as it was only used in a single place and is no longer needed. * Marshal#dump is fixed to skip iclass origins. * rb_method_entry_make is fixed to handled overridden optimized methods for modules that have origins. Fixes [Bug #16852]
* sed -i 's|ruby/impl|ruby/internal|'卜部昌平2020-05-111-1/+1
| | | | To fix build failures.
* sed -i s|ruby/3|ruby/impl|g卜部昌平2020-05-111-1/+1
| | | | This shall fix compile errors.
* Optimize sin/cosNobuyoshi Nakada2020-05-031-4/+15
| | | | | | | | | GCC/Clang can optimize to calculate `sin(x)` and `cos(x)` at once, when the both are closely called on the same argument. Similar optimization is possible for `__sinpi(x)` and `__cospi(x)` if available, which calculate arguments in radian, i.e. `sin(x*M_PI)` and `cos(x*M_PI)` respectively.
* reroute redefinition of NDEBUG卜部昌平2020-04-211-0/+1
| | | | | NDEBUG can be defined via a command-line argument. Should take care of such situations.
* Merge pull request #2991 from shyouhei/ruby.h卜部昌平2020-04-081-3/+2
| | | Split ruby.h
* decouple internal.h headers卜部昌平2019-12-261-4/+12
| | | | | | | | | | | | | | | | | | Saves comitters' daily life by avoid #include-ing everything from internal.h to make each file do so instead. This would significantly speed up incremental builds. We take the following inclusion order in this changeset: 1. "ruby/config.h", where _GNU_SOURCE is defined (must be the very first thing among everything). 2. RUBY_EXTCONF_H if any. 3. Standard C headers, sorted alphabetically. 4. Other system headers, maybe guarded by #ifdef 5. Everything else, sorted alphabetically. Exceptions are those win32-related headers, which tend not be self- containing (headers have inclusion order dependencies).
* Improve consistency of bool/true/falseKazuhiro NISHIYAMA2019-11-251-6/+6
|
* Make Kernel#{Pathname,BigDecimal,Complex} return argument if given correct typeJeremy Evans2019-09-211-0/+3
| | | | | | | | | | | | This is how Kernel#{Array,String,Float,Integer,Hash,Rational} work. BigDecimal and Complex instances are always frozen, so this should not cause backwards compatibility issues for those. Pathname instances are not frozen, so potentially this could cause backwards compatibility issues by not returning a new object. Based on a patch from Joshua Ballanco, some minor changes by me. Fixes [Bug #7522]
* Expanded f_quoNobuyoshi Nakada2019-08-101-1/+13
|
* Expanded f_real_pNobuyoshi Nakada2019-08-101-2/+22
|
* Predefine some IDsNobuyoshi Nakada2019-08-031-3/+3
|
* Expanded f_numeratorNobuyoshi Nakada2019-07-161-1/+12
|
* Expanded f_denominatorNobuyoshi Nakada2019-07-161-2/+12
|
* Expand f_arg to use particular functions directlyNobuyoshi Nakada2019-07-141-1/+21
|
* Expand f_abs to use particular functions directlyNobuyoshi Nakada2019-07-141-1/+18
|
* Removed binop macro which has not been usedNobuyoshi Nakada2019-07-141-7/+0
|
* Calculate float complex division per each partNobuyoshi Nakada2019-07-141-10/+4
| | | | | Arguments to f_complex_new2 should not be Complex, or violate the assertion.
* Check exception flag as a bool [Bug #15987]Nobuyoshi Nakada2019-07-111-7/+1
|
* * expand tabs.git2019-06-201-1/+1
|
* Implement Complex#<=>Jeremy Evans2019-06-191-5/+42
| | | | | | | | | | | Implement Complex#<=> so that it is usable as an argument when calling <=> on objects of other classes (since #coerce will coerce such numbers to Complex). If the complex number has a zero imaginary part, and the other argument is a real number (or complex number with zero imaginary part), return -1, 0, or 1. Otherwise, return nil, indicating the objects are not comparable. Fixes [Bug #15857]
* Split long expressionNobuyoshi Nakada2019-04-231-5/+4
|
* No TypeError at nil if exception: falsenobu2019-01-121-1/+3
| | | | | | [ruby-core:91021] [Bug #15525] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* complex.c: optimize zero check for Floatmrkn2019-01-091-1/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* complex.c: replace misused UNLIKELY with LIKELYmrkn2019-01-081-8/+8
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* complex.c (f_divide): canonicalize a quotientmrkn2019-01-071-4/+5
| | | | | | | | | | | Cannonicalize resultant real and imaginary parts when complex number divided by non-complex number. [Fix GH-2065] [Bug #15505] [ruby-core:90891] From: Joe Peric <peric.joe@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* complex.c: Optimize Complex#* and Complex#**mrkn2019-01-031-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Optimize f_mul for the core numeric class components. This change improves the computation time of Complex#* and Complex#**. ``` $ make benchmark ITEM=complex_float_ COMPARE_RUBY=/Users/mrkn/.rbenv/versions/2.6.0/bin/ruby generating known_errors.inc known_errors.inc unchanged /Users/mrkn/src/github.com/ruby/ruby/revision.h unchanged /Users/mrkn/.rbenv/shims/ruby --disable=gems -rrubygems -I/Users/mrkn/src/github.com/ruby/ruby/benchmark/lib /Users/mrkn/src/github.com/ruby/ruby/benchmark/benchmark-driver/exe/benchmark-driver \ --executables="compare-ruby::/Users/mrkn/.rbenv/versions/2.6.0/bin/ruby -I.ext/common --disable-gem" \ --executables="built-ruby::./miniruby -I/Users/mrkn/src/github.com/ruby/ruby/lib -I. -I.ext/common -r/Users/mrkn/src/github.com/ruby/ruby/prelude --disable-gem" \ $(find /Users/mrkn/src/github.com/ruby/ruby/benchmark -maxdepth 1 -name '*complex_float_*.yml' -o -name '*complex_float_*.rb' | sort) Calculating ------------------------------------- compare-ruby built-ruby complex_float_add 6.558M 13.012M i/s - 1.000M times in 0.152480s 0.076850s complex_float_div 576.821k 567.969k i/s - 1.000M times in 1.733640s 1.760660s complex_float_mul 1.690M 2.628M i/s - 1.000M times in 0.591786s 0.380579s complex_float_new 1.350M 1.268M i/s - 1.000M times in 0.740669s 0.788762s complex_float_power 1.571M 1.835M i/s - 1.000M times in 0.636507s 0.544909s complex_float_sub 8.635M 8.779M i/s - 1.000M times in 0.115814s 0.113906s Comparison: complex_float_add built-ruby: 13012361.7 i/s compare-ruby: 6558237.1 i/s - 1.98x slower complex_float_div compare-ruby: 576821.0 i/s built-ruby: 567968.8 i/s - 1.02x slower complex_float_mul built-ruby: 2627575.4 i/s compare-ruby: 1689800.0 i/s - 1.55x slower complex_float_new compare-ruby: 1350130.8 i/s built-ruby: 1267809.6 i/s - 1.06x slower complex_float_power built-ruby: 1835168.8 i/s compare-ruby: 1571074.6 i/s - 1.17x slower complex_float_sub built-ruby: 8779168.8 i/s compare-ruby: 8634534.7 i/s - 1.02x slower ``` git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66697 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* [DOC] Complex() default behaviour is `exception: true` [ci skip]kazu2019-01-031-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66696 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* [DOC] Add `or nil` to call-seq [ci skip]kazu2019-01-031-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e