| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
NDEBUG can be defined via a command-line argument. Should take care of
such situations.
|
|
|
| |
Split ruby.h
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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).
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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]
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Arguments to f_complex_new2 should not be Complex, or violate the
assertion.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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]
|
| |
|
|
|
|
|
|
| |
[ruby-core:91021] [Bug #15525]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66696 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
| |
This fixes the incompatibility (maybe unintentionally) introduced by
removal of `#ifndef PRESERVE_SIGNEDZERO` guards in f_add, f_mul, and
f_sub functions in r62701. [Bug #15491] [ruby-core:90843]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Optimize f_add defined in complex.c for some specific conditions.
It makes Complex#+ about 1.4x faster than r66678.
Compared to r66678:
```
mrkn-mbp15-late2016:complex-optim-o3 mrkn$ make benchmark ITEM=complex_float_ COMPARE_RUBY=/Users/mrkn/.rbenv/versions/trunk-o3/bin/ruby
/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/trunk-o3/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 9.132M 12.864M i/s - 1.000M times in 0.109511s 0.077734s
complex_float_div 600.723k 627.878k i/s - 1.000M times in 1.664662s 1.592666s
complex_float_mul 2.320M 2.347M i/s - 1.000M times in 0.431039s 0.426113s
complex_float_new 1.473M 1.489M i/s - 1.000M times in 0.678791s 0.671750s
complex_float_power 1.690M 1.722M i/s - 1.000M times in 0.591863s 0.580775s
complex_float_sub 8.870M 9.516M i/s - 1.000M times in 0.112740s 0.105091s
Comparison:
complex_float_add
built-ruby: 12864383.7 i/s
compare-ruby: 9131502.8 i/s - 1.41x slower
complex_float_div
built-ruby: 627878.0 i/s
compare-ruby: 600722.5 i/s - 1.05x slower
complex_float_mul
built-ruby: 2346795.3 i/s
compare-ruby: 2319975.7 i/s - 1.01x slower
complex_float_new
built-ruby: 1488649.1 i/s
compare-ruby: 1473207.5 i/s - 1.01x slower
complex_float_power
built-ruby: 1721837.2 i/s
compare-ruby: 1689580.2 i/s - 1.02x slower
complex_float_sub
built-ruby: 9515562.7 i/s
compare-ruby: 8869966.3 i/s - 1.07x slower
```
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66681 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
| |
These settings are now covered by .dir-locals.el.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66584 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
| |
From: Victor Shepelev <zverok.offline@gmail.com>
[ruby-core:90673] [Bug #15452]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
| |
[Feature #15066]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66360 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
|
| |
* complex.c (rb_complex_new_polar): renamed with _new to clarify
that it creates a new instance, but is not an instance method.
* complex.c (rb_complex_polar): deprecated.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66179 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
| |
* complex.c (rb_dbl_complex_polar_pi): suffixed with _pi to
clarify that `ang` is not radian, but multiplied by PI.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
| |
* complex.c (rb_complex_pow): calculate power of a Fixnum without
allocating intermediate Complex objects, and avoid unexpected
NaNs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
| |
* complex.c (f_divide): canonicalize rationals to simplify integer
complex results.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64610 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
| |
* complex.c (RFLOAT_0): share the 0.0 object on non-flonum
platforms.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
|
|
|
|
| |
* complex.c (rb_dbl_complex_polar): utility function, which
returns more precise value in right angle cases.
* bignum.c (rb_big_pow): use rb_dbl_complex_polar().
* numeric.c (rb_float_pow, fix_pow): create a Complex by polar
form.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
| |
* complex.c: [DOC] correct term "real value" to "real part", and same
for imaginary part, in documentation for Complex#{finite?,infinite?}.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
|
|
| |
to state what it really does.
[Fix GH-1848]
From: Christian Bruckmayer <cbruckmayer@suse.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
|
|
| |
to state what it really does.
[Fix GH-1848]
From: Christian Bruckmayer <cbruckmayer@suse.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
|
|
| |
Support `exception:` keyword argument in `Kernel#Complex()`.
If `exception:` is `false`, `Kernel#Complex()` returns `nil` if the given
value cannot be interpreted as a complex value.
The default value of `exception:` is `true`.
This is part of [Feature #12732].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
| |
Fixnums can be compared by object values themselves only.
Addition/subtraction/mulplication of fixnum 0 do not affect the
sign.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
| |
* complex.c (m_cos, m_sin): determine the type by the internal
type, not by a method.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62689 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
| |
* complex.c (nucomp_s_canonicalize_internal): determine the type
by the internal type, not by a method.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|