summaryrefslogtreecommitdiff
path: root/numeric.c
AgeCommit message (Collapse)Author
2023-12-07Use free with ruby_dtoaJohn Hawthorn
In ae0ceafb0c0d05cc80623b525070255e3abb34ef ruby_dtoa was switched to use malloc instead of xmalloc, which means that consumers should be using free instead of xfree. Otherwise we will artificially shrink oldmalloc_increase_bytes.
2023-11-29[Bug #17037] Improve accuracy of division near precision limitsNobuyoshi Nakada
When dividing near the precision limit of `double`, use Bignum division to get rid of rounding errors.
2023-10-15[DOC] Fix the argument name in the Numeric#step docKouhei Yanagita
2023-10-14[Bug #19926] Fix Range#size for ranges with a Rational endpointKouhei Yanagita
2023-09-27[DOC] Missing comment markersNobuyoshi Nakada
2023-09-07Rewrite Integer#times in Ruby (#8388)Takashi Kokubun
Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2023-08-13[DOC] Don't suppress autolinksBurdetteLamar
Notes: Merged: https://github.com/ruby/ruby/pull/8215
2023-06-28[DOC] Fixes for link fragments (#7981)Burdette Lamar
Notes: Merged-By: peterzhu2118 <peter@peterzhu.ca>
2023-05-29Unify error messages of rb_num2ulong and rb_num2ullPeter Zhu
The error messages were slightly different due, which causes different behaviour on 32-bit and 64-bit systems. Notes: Merged: https://github.com/ruby/ruby/pull/7872
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-06Stop exporting symbols for MJITTakashi Kokubun
Notes: Merged: https://github.com/ruby/ruby/pull/7459
2023-02-19Remove (newly unneeded) remarks about aliasesBurdetteLamar
2023-02-17[Bug#19445] Fix keyword splat in enumeratorNobuyoshi Nakada
Extracted arguments do not have keyword hash to splat. Notes: Merged: https://github.com/ruby/ruby/pull/7325 Merged-By: nobu <nobu@ruby-lang.org>
2023-01-30Avoid using a weird syntax for documentationTakashi Kokubun
Following up 465bd972ec2. If the actual implementation still resides in C, it should be documented in C just like all other places.
2023-01-15[Bug #19335] `Integer#remainder` should respect `#coerce` (#7120)Nobuyoshi Nakada
Also `Numeric#remainder` should. Notes: Merged-By: mrkn <mrkn@ruby-lang.org>
2022-12-26numeric.c: Fix round_half_even for specific values (#7023)Kenta Murata
Handle the integert and the float parts separately in round_half_even to prevent error occursions in floating point calculation. Notes: Merged-By: mrkn <mrkn@ruby-lang.org>
2022-11-16Using UNDEF_P macroS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/6721
2022-10-14Use `roomof` macro for rounding up divisionsNobuyoshi Nakada
2022-08-12Improve performance of Integer#ceildivKouhei Yanagita
This patch is suggested by nobu. Benchmark result: ``` require 'benchmark' n = 10 ** 7 Benchmark.bm do |x| x.report("Fixnum/Fixnum") { a, b = 5, 2; n.times { a.ceildiv(b) } } x.report("Bignum/Bignum") { a, b = 10**100, 10**99 - 1; n.times { a.ceildiv(b) } } x.report("Bignum/Fixnum") { a, b = 10**100, 3; n.times { a.ceildiv(b) } } end ``` Original: ``` user system total real Fixnum/Fixnum 3.340009 0.043029 3.383038 ( 3.384022) Bignum/Bignum 8.229500 0.118543 8.348043 ( 8.349574) Bignum/Fixnum 8.328971 0.097842 8.426813 ( 8.426952) ``` Improved: ``` user system total real Fixnum/Fixnum 0.699140 0.000961 0.700101 ( 0.700199) Bignum/Bignum 5.076165 0.083160 5.159325 ( 5.159360) Bignum/Fixnum 5.548684 0.115372 5.664056 ( 5.666735) ``` Notes: Merged: https://github.com/ruby/ruby/pull/5965
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-06-03[DOC] Fix documentation of Numeric#div: Complex does not have #divKouhei Yanagita
Notes: Merged: https://github.com/ruby/ruby/pull/5964
2022-05-27[DIC] Fix typo in documentationKouhei Yanagita
Notes: Merged: https://github.com/ruby/ruby/pull/5962 Merged-By: nobu <nobu@ruby-lang.org>
2022-04-13Use correct capitalization of "NaN" in docsGrant Hutchins
Notes: Merged: https://github.com/ruby/ruby/pull/5797
2022-03-26[DOC] Use simple references to operator methodsNobuyoshi Nakada
Method references is not only able to be marked up as code, also reflects `--show-hash` option. The bug that prevented the old rdoc from correctly parsing these methods was fixed last month.
2022-03-25[DOC] Fix formatting for What's Here in IO (#5719)Burdette Lamar
* Fix formatting for What's Here in IO * Repair formatting in What's Heres in numeric.c * Fix formatting for What's Here in IO Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2022-02-13[DOC] Fix a typo in `Integer#chr` exampleKoichi ITO
The current example raises the following error. ```ruby 0..chr # => undefined local variable or method `chr' for main:Object (NameError) ``` This PR updates the example to produce the expected behavior. ```ruby 0.chr # => "\x00" ``` Notes: Merged: https://github.com/ruby/ruby/pull/5550
2022-02-12[DOC] Simplify operator method referencesNobuyoshi Nakada
2022-02-08[DOC] Fix broken links to literals.rdocNobuyoshi Nakada
2022-02-08[DOC] Simplify links to global methodsNobuyoshi Nakada
2022-02-07[DOC] Use RDoc link style for links in the same class/modulePeter Zhu
I used this regex: (?<=\[)#(?:class|module)-([A-Za-z]+)-label-([A-Za-z0-9\-\+]+) And performed a global find & replace for this: rdoc-ref:$1@$2 Notes: Merged: https://github.com/ruby/ruby/pull/5530
2022-02-07[DOC] Use RDoc link style for links to other classes/modulesPeter Zhu
I used this regex: ([A-Za-z]+)\.html#(?:class|module)-[A-Za-z]+-label-([A-Za-z0-9\-\+]+) And performed a global find & replace for this: rdoc-ref:$1@$2 Notes: Merged: https://github.com/ruby/ruby/pull/5530
2022-01-27Shifting zero always results in zero [Bug #18517]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/5494
2022-01-01Negative RBOOL usageNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/5385
2022-01-01Make the internal predict `int_zero_p` return a boolNobuyoshi Nakada
2021-12-28Remove obsolete Fixnum and BignumNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/3927
2021-12-08[DOC] Integer.try_convert [ci skip]Nobuyoshi 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-12-01Don't call + and < in Integer.times for !FIXNUMJeremy Evans
The methods aren't called for FIXNUM, and it's best to have consistent behavior. Fixes [Bug #18377] Notes: Merged: https://github.com/ruby/ruby/pull/5199
2021-11-27Enhanced RDoc for numeric.c (#5184)Burdette Lamar
Adds remarks about literals and Kernel methods to Float and Integer. Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2021-11-25Correct indentation error in numeric.c (#5178)Burdette Lamar
Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2021-11-24Whats here for float (#5170)Burdette Lamar
* What's Here for Float Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2021-11-24Enhanced RDoc for Float#floor (#5167)Burdette Lamar
* Enhanced RDoc for Float#floor * Enhanced RDoc for Float * Enhanced RDoc for Float Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2021-11-24Enhanced RDoc for Float#prev_float (#5162)Burdette Lamar
* Enhanced RDoc for Float#prev_float Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2021-11-23Enhanced RDoc for Float#next_float (#5160)Burdette Lamar
* Enhanced RDoc for Float#next_float Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2021-11-22What's Here section for Integer (#5155)Burdette Lamar
* What's Here section for Integer Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2021-11-22Enhanced RDoc for Float (#5153)Burdette Lamar
Treats: #> #>= #< #<= #eql? #nan? #infinite? #finite? Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2021-11-20Enhanced RDoc for Float (#5150)Burdette Lamar
Treated (or previously treated): #quo #% #divmod #**` #eql? #<=> #== #hash Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2021-11-19Enhanced RDoc for Float (#5144)Burdette Lamar
Treats: #to_s #coerce #+ #- #* #/ Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>