summaryrefslogtreecommitdiff
path: root/complex.c
AgeCommit message (Collapse)Author
2024-04-16Eliminate usage of OBJ_FREEZE_RAWJean Boussier
Previously it would bypass the `FL_ABLE` check, but since shapes introduction, it started having a different behavior than `OBJ_FREEZE`, as it would onyl set the `FL_FREEZE` flag, but not update the shape. I have no indication of this causing a bug yet, but it seems like a trap waiting to happen.
2024-03-06Refactor VM root modulesJean Boussier
This `st_table` is used to both mark and pin classes defined from the C API. But `vm->mark_object_ary` already does both much more efficiently. Currently a Ruby process starts with 252 rooted classes, which uses `7224B` in an `st_table` or `2016B` in an `RArray`. So a baseline of 5kB saved, but since `mark_object_ary` is preallocated with `1024` slots but only use `405` of them, it's a net `7kB` save. `vm->mark_object_ary` is also being refactored. Prior to this changes, `mark_object_ary` was a regular `RArray`, but since this allows for references to be moved, it was marked a second time from `rb_vm_mark()` to pin these objects. This has the detrimental effect of marking these references on every minors even though it's a mostly append only list. But using a custom TypedData we can save from having to mark all the references on minor GC runs. Addtionally, immediate values are now ignored and not appended to `vm->mark_object_ary` as it's just wasted space.
2024-02-27Handle zero-like imaginary part as zero in to_r (#9581)Kenta Murata
Fixes [Bug #5179]
2024-02-26[Bug #20296] Clear errinfo when `exception: false`Nobuyoshi Nakada
2024-02-22Fix -Wmaybe-uninitialized on Complex#** (#10075)Takashi Kokubun
2024-02-12Replace assert with RUBY_ASSERT in complex.cPeter Zhu
assert does not print the bug report, only the file and line number of the assertion that failed. RUBY_ASSERT prints the full bug report, which makes it much easier to debug.
2024-01-30Use `UNDEF_P`Nobuyoshi Nakada
2023-12-28[DOC] Add What's Here for Complex (#9366)Burdette Lamar
2023-12-26RDoc for ComplexBurdetteLamar
2023-12-25RDoc for complex.cBurdetteLamar
2023-12-24RDoc for complex.cBurdetteLamar
2023-12-24RDoc for ComplexBurdetteLamar
2023-12-22[DOC] RDoc for Complex (#9307)Burdette Lamar
2023-12-19RDoc for ComplexBurdetteLamar
2023-12-19RDoc for ComplexBurdetteLamar
2023-12-18[DOC] RDoc for Complex (#9260)Burdette Lamar
2023-12-15[DOC] RDoc for Complex (#9254)Burdette Lamar
2023-12-15[DOC] RDoc for Complex (#9243)Burdette Lamar
2023-12-14[DOC] RDoc for Complex (#9231)Burdette Lamar
2023-12-12[DOC] RDoc for ComplexBurdetteLamar
2023-12-11[DOC] Complex doc (#9185)Burdette Lamar
2023-12-11Use dedicated functions to check terminatorsNobuyoshi Nakada
2023-12-10[DOC] RDoc for Complex (#9181)Burdette Lamar
2023-12-08RDoc for ComplexBurdetteLamar
2023-12-07RDoc for ComplexBurdetteLamar
2023-11-22Prevent a compiler warning: ‘zi’ may be used uninitializedYusuke Endoh
2023-11-21[Bug #11183] Fix rb_complex_pow for special anglesKouhei Yanagita
Add a special treatment for when the argument of self is an integral multiple of 45 degrees. 1i ** (10 ** 100) #=> 1+0i 1i ** (10 ** 100 + 1) #=> 0+1i (1+1i) ** (10 ** 100) # warning: in a**b, b may be too big #=> (Infinity+0.0i) (1+1i) ** (10 ** 100 + 1) # warning: in a**b, b may be too big #=> (Infinity+Infinity*i)
2023-04-06[Feature #19474] Refactor NEWOBJ macrosMatt Valentine-House
NEWOBJ_OF is now our canonical newobj macro. It takes an optional ec Notes: Merged: https://github.com/ruby/ruby/pull/7393
2023-03-13[DOC] Enhanced RDoc for NilClass (#7500)Burdette Lamar
Notes: Merged-By: peterzhu2118 <peter@peterzhu.ca>
2022-12-02[Bug #19087] Disallow successive underscores in Complex stringNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/6645
2022-11-16Using UNDEF_P macroS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/6721
2022-10-27Improve performance some `Integer` and `Float` methods [Feature #19085] (#6638)S.H
* Improve some Integer and Float methods * Using alias and Remove unnecessary code * Remove commentout code Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2022-10-23Reduce type check of arguments at Complex creationNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/6618
2022-10-23[Bug #19004] `Complex.polar` handles complex singular `abs` argumentStephen Ierodiaconou
`Complex.polar` accepts Complex values as arguments for the polar form as long as the value of the complex has no imaginary part (ie it is 'real'). In `f_complex_polar` this is handled by extracting the real part of the arguments. However in the case `polar` is called with only a single argument, the absolute value (abs), then the Complex is created without applying a check on the type of abs, meaning it is possible to create a Complex where the real part is itself an instance of a Complex. This change removes the short circuit for the single argument case meaning the real part extraction is performed correctly (by f_complex_polar). Also adds an example to `spec/ruby/core/complex/polar_spec.rb` to check that the real part of a complex argument is correctly extracted and used in the resulting Complex real and imaginary parts. Notes: Merged: https://github.com/ruby/ruby/pull/6568 Merged-By: nobu <nobu@ruby-lang.org>
2022-10-17[DOC] Add the polar form in String#to_cNobuyoshi Nakada
2022-09-02Consider Complex from Complex casesNobuyoshi Nakada
The assertions that "an argument of a Complex constructor must not be a Complex" may not hold for some Numeric objects. Notes: Merged: https://github.com/ruby/ruby/pull/6317
2022-09-02[Bug #18937] Coerce non-real non-Numeric into Complex at comparisonsNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/6317
2022-09-02Turn `f_zero_p` to `bool`Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/6317
2022-08-22[Bug #18937] Coerce non-Numeric into Complex at comparisonsNobuyoshi Nakada
2022-08-12Remove Numeric#ceildivKouhei Yanagita
Notes: Merged: https://github.com/ruby/ruby/pull/5965
2022-08-12Add Numeric#ceildiv and Integer#ceildivKouhei Yanagita
Notes: Merged: https://github.com/ruby/ruby/pull/5965
2022-07-21Expand tabs [ci skip]Takashi Kokubun
[Misc #18891] Notes: Merged: https://github.com/ruby/ruby/pull/6094
2022-02-08[DOC] Fix broken links to literals.rdocNobuyoshi Nakada
2022-02-08[DOC] Simplify links to global methodsNobuyoshi Nakada
2021-12-03Adding links to literals and Kernel (#5192)Burdette Lamar
* Adding links to literals and Kernel Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2021-10-18Remove declarations unused since a95262356ef5Nobuyoshi Nakada
2021-09-15Refactor and Using RBOOL macroS.H
Notes: Merged: https://github.com/ruby/ruby/pull/4837 Merged-By: nobu <nobu@ruby-lang.org>
2021-09-11Using RB_BIGNUM_TYPE_P macroS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/4805
2021-09-10include/ruby/internal/intern/complex.h: add doxygen卜部昌平
Must not be a bad idea to improve documents. [ci skip] Notes: Merged: https://github.com/ruby/ruby/pull/4815
2021-09-03Remove unneeded commentS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/4803