aboutsummaryrefslogtreecommitdiffstats
path: root/numeric.c
Commit message (Collapse)AuthorAgeFilesLines
* Use free with ruby_dtoaJohn Hawthorn2023-12-071-1/+1
| | | | | | | 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.
* [Bug #17037] Improve accuracy of division near precision limitsNobuyoshi Nakada2023-11-291-2/+8
| | | | | When dividing near the precision limit of `double`, use Bignum division to get rid of rounding errors.
* [DOC] Fix the argument name in the Numeric#step docKouhei Yanagita2023-10-151-6/+6
|
* [Bug #19926] Fix Range#size for ranges with a Rational endpointKouhei Yanagita2023-10-141-1/+1
|
* [DOC] Missing comment markersNobuyoshi Nakada2023-09-271-7/+7
|
* Rewrite Integer#times in Ruby (#8388)Takashi Kokubun2023-09-071-53/+0
|
* [DOC] Don't suppress autolinksBurdetteLamar2023-08-131-8/+8
|
* [DOC] Fixes for link fragments (#7981)Burdette Lamar2023-06-281-1/+1
|
* Unify error messages of rb_num2ulong and rb_num2ullPeter Zhu2023-05-291-10/+5
| | | | | The error messages were slightly different due, which causes different behaviour on 32-bit and 64-bit systems.
* [Feature #19474] Refactor NEWOBJ macrosMatt Valentine-House2023-04-061-1/+1
| | | | NEWOBJ_OF is now our canonical newobj macro. It takes an optional ec
* Stop exporting symbols for MJITTakashi Kokubun2023-03-061-11/+11
|
* Remove (newly unneeded) remarks about aliasesBurdetteLamar2023-02-191-19/+0
|
* [Bug#19445] Fix keyword splat in enumeratorNobuyoshi Nakada2023-02-171-1/+1
| | | Extracted arguments do not have keyword hash to splat.
* Avoid using a weird syntax for documentationTakashi Kokubun2023-01-301-1/+16
| | | | | | | Following up 465bd972ec2. If the actual implementation still resides in C, it should be documented in C just like all other places.
* [Bug #19335] `Integer#remainder` should respect `#coerce` (#7120)Nobuyoshi Nakada2023-01-151-4/+17
| | | Also `Numeric#remainder` should.
* numeric.c: Fix round_half_even for specific values (#7023)Kenta Murata2022-12-261-10/+16
| | | | Handle the integert and the float parts separately in round_half_even to prevent error occursions in floating point calculation.
* Using UNDEF_P macroS-H-GAMELINKS2022-11-161-8/+8
|
* Use `roomof` macro for rounding up divisionsNobuyoshi Nakada2022-10-141-1/+1
|
* Improve performance of Integer#ceildivKouhei Yanagita2022-08-121-23/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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) ```
* Remove Numeric#ceildivKouhei Yanagita2022-08-121-26/+0
|
* Add Numeric#ceildiv and Integer#ceildivKouhei Yanagita2022-08-121-0/+49
|
* Expand tabs [ci skip]Takashi Kokubun2022-07-211-797/+797
| | | | [Misc #18891]
* [DOC] Fix documentation of Numeric#div: Complex does not have #divKouhei Yanagita2022-06-031-1/+1
|
* [DIC] Fix typo in documentationKouhei Yanagita2022-05-271-3/+3
|
* Use correct capitalization of "NaN" in docsGrant Hutchins2022-04-131-1/+1
|
* [DOC] Use simple references to operator methodsNobuyoshi Nakada2022-03-261-16/+16
| | | | | | | 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.
* [DOC] Fix formatting for What's Here in IO (#5719)Burdette Lamar2022-03-251-133/+133
| | | | | | | * 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
* [DOC] Fix a typo in `Integer#chr` exampleKoichi ITO2022-02-131-1/+1
| | | | | | | | | | | | | | 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" ```
* [DOC] Simplify operator method referencesNobuyoshi Nakada2022-02-121-28/+26
|
* [DOC] Fix broken links to literals.rdocNobuyoshi Nakada2022-02-081-2/+2
|
* [DOC] Simplify links to global methodsNobuyoshi Nakada2022-02-081-2/+2
|
* [DOC] Use RDoc link style for links in the same class/modulePeter Zhu2022-02-071-11/+11
| | | | | | | | | | 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
* [DOC] Use RDoc link style for links to other classes/modulesPeter Zhu2022-02-071-4/+4
| | | | | | | | | | 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
* Shifting zero always results in zero [Bug #18517]Nobuyoshi Nakada2022-01-271-0/+2
|
* Negative RBOOL usageNobuyoshi Nakada2022-01-011-1/+1
|
* Make the internal predict `int_zero_p` return a boolNobuyoshi Nakada2022-01-011-6/+6
|
* Remove obsolete Fixnum and BignumNobuyoshi Nakada2021-12-281-4/+0
|
* [DOC] Integer.try_convert [ci skip]Nobuyoshi Nakada2021-12-081-0/+1
|
* Adding links to literals and Kernel (#5192)Burdette Lamar2021-12-031-3/+9
| | | | * Adding links to literals and Kernel
* Don't call + and < in Integer.times for !FIXNUMJeremy Evans2021-12-011-2/+2
| | | | | | | The methods aren't called for FIXNUM, and it's best to have consistent behavior. Fixes [Bug #18377]
* Enhanced RDoc for numeric.c (#5184)Burdette Lamar2021-11-271-2/+12
| | | Adds remarks about literals and Kernel methods to Float and Integer.
* Correct indentation error in numeric.c (#5178)Burdette Lamar2021-11-251-4/+4
|
* Whats here for float (#5170)Burdette Lamar2021-11-241-0/+57
| | | * What's Here for Float
* Enhanced RDoc for Float#floor (#5167)Burdette Lamar2021-11-241-138/+146
| | | | | | | * Enhanced RDoc for Float#floor * Enhanced RDoc for Float * Enhanced RDoc for Float
* Enhanced RDoc for Float#prev_float (#5162)Burdette Lamar2021-11-241-57/+34
| | | * Enhanced RDoc for Float#prev_float
* Enhanced RDoc for Float#next_float (#5160)Burdette Lamar2021-11-231-46/+54
| | | | * Enhanced RDoc for Float#next_float
* What's Here section for Integer (#5155)Burdette Lamar2021-11-221-4/+83
| | | * What's Here section for Integer
* Enhanced RDoc for Float (#5153)Burdette Lamar2021-11-221-42/+90
| | | | | | | | | | | | | Treats: #> #>= #< #<= #eql? #nan? #infinite? #finite?
* Enhanced RDoc for Float (#5150)Burdette Lamar2021-11-201-25/+57
| | | | | | | | | | | | | Treated (or previously treated): #quo #% #divmod #**` #eql? #<=> #== #hash
* Enhanced RDoc for Float (#5144)Burdette Lamar2021-11-191-19/+57
| | | | | | | | | | | Treats: #to_s #coerce #+ #- #* #/