summaryrefslogtreecommitdiff
path: root/numeric.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Enhanced RDoc for Numeric (#4994)Burdette Lamar2021-10-281-68/+120
| | | | | | | | | | | | Treats: #eql? #<+> #floor #ceil #round #truncate #step
* Embed bare `double` if `sizeof(double) == sizeof(VALUE)`Nobuyoshi Nakada2021-10-271-1/+1
|
* Align `RFloat` at VALUE boundaryNobuyoshi Nakada2021-10-271-2/+6
|
* Fix unaligned access to `double` in RFloatNobuyoshi Nakada2021-10-261-0/+4
|
* Enhanced RDoc for Numeric (#4991)Burdette Lamar2021-10-191-33/+59
| | | | | | | | | | | | | | Treated: #@- #fdiv #div #abs #zero? #nonzero? #to_int #positive? #negative?
* Enhanced RDoc for numerics (#4982)Burdette Lamar2021-10-181-27/+63
| | | | | | | | | | | Treats: Numeric#coerce Numeric#clone Numeric#dup Numeric#@+ (unary plus) Numeric#i Float#coerce
* Enhanced RDoc for remainder (#4975)Burdette Lamar2021-10-151-12/+40
| | | Treats Numeric#remainder and Integer#remainder.
* Enhanced RDoc for divmod (#4973)Burdette Lamar2021-10-151-50/+69
| | | | | | | | Treats: Integer#divmod Float#divmod Numeric#divmod
* Enhanced RDoc for numeric.c (#4964)Burdette Lamar2021-10-151-16/+55
| | | Treats Integer#% and Float#%.
* Enhanced RDoc for Numeric#% (#4954)Burdette Lamar2021-10-121-4/+28
|
* Add flo_ndigits functionS-H-GAMELINKS2021-10-101-9/+11
|
* Refactor and Using RBOOL macroS.H2021-09-151-26/+13
|
* Using RB_FLOAT_TYPE_P macroS-H-GAMELINKS2021-09-121-40/+40
|
* Replace RB_TYPE_P macro to FIXNUM_P and RB_INTEGER_TYPE_P macroS-H-GAMELINKS2021-09-121-13/+13
|
* Using NIL_P macro instead of RB_TYPE_P macroS-H-GAMELINKS2021-09-111-1/+1
|
* Using RB_BIGNUM_TYPE_P macroS-H-GAMELINKS2021-09-111-79/+79
|
* [DOC] Move rdoc of Integer#abs to numeric.rb [ci skip]Nobuyoshi Nakada2021-08-301-16/+0
|
* Use C99-defined macros to classify a floating-point numberNobuyoshi Nakada2021-08-271-9/+1
|
* rb_fix2uint should use FIXNUM_NEGATIVE_PJohn Hawthorn2021-08-181-2/+2
| | | | | | | | | | | | | | rb_num_negative_int_p is equivalent to calling the "<" method on Integer (and checking whether it is overridden), where in this case we are interested in whether the "actual" value can fit inside an unsigned int. This also was slow because rb_num_negative_int_p calls rb_method_basic_definition_p, doing a method lookup to check for < being overridden. This replaces the check in both rb_fix2uint and rb_fix2ushort with FIXNUM_NEGATIVE_P which simply checks whether the VALUE is signed.
* Use Rational for Float#round with ndigits > 14Jeremy Evans2021-08-061-0/+4
| | | | | | | | | | | ndigits higher than 14 can result in values that are slightly too large due to floating point limitations. Converting to rational for the calculation and then back to float fixes these issues. Fixes [Bug #14635] Fixes [Bug #17183] Co-authored by: Yusuke Endoh <mame@ruby-lang.org>
* Using RBOOL macroS.H2021-08-021-26/+19
|
* Improve performance of Integer#digitsJeremy Evans2021-07-291-6/+27
| | | | | | | | | This speeds up performance by multiple orders of magnitude for large integers. Fixes [Bug #14391] Co-authored-by: tompng (tomoya ishida) <tomoyapenguin@gmail.com>
* Make Float#floor with ndigits argument handle errorJeremy Evans2021-07-271-3/+7
| | | | | | | | | | | | | | The previous implementation could result in a returned float that is 1/(10**ndigits) too low. First try adding one before dividing, and if that results in a value that is greater than the initial number, then try the original calculation. Spec added for ciel, but the issue doesn't appear to affect ciel, at least not for the same number. If the issue does effect ciel, a similar fix could probably work for it. Fixes [Bug #18018]
* Add Integer.try_convert [Feature #15211]Nobuyoshi Nakada2021-07-161-0/+7
|
* What's Here for Numeric and ComparableBurdette Lamar2021-06-211-0/+80
|
* Improve perfomance for Integer#size method [Feature #17135] (#3476)S.H2021-06-041-19/+2
| | | | | | | | | * Improve perfomance for Integer#size method [Feature #17135] * re-run ci * Let MJIT frame skip work for Integer#size Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
* Fix Enumerator::ArithmeticSequence handling of float rangesJeremy Evans2021-05-291-2/+18
| | | | | | | | | | Depending on the float range, there could be an off-by-one error, where the last result that should be in the range was missed. Fix this by checking if the computed value for the expected value outside the range is still inside the range, and if so, increment the step size. Fixes [Bug #16612]
* Refactor num_zero_p function (#4522)S.H2021-05-231-4/+1
|
* Fix integer/float remainder with infinity argument of opposite signJeremy Evans2021-03-121-3/+8
| | | | | | | | | | | | | | Previously, the result was incorrect: 4.remainder(-Float::INFINITY) Before: => NaN After: => 4 4.2.remainder(-Float::INFINITY) Before: => NaN After: => 4.2 Fixes [Bug #6120]
* Improve performance some Numeric methods [Feature #17632] (#4190)S.H2021-02-191-58/+0
|
* Improve performance Float#positive? and Float#negative? [Feature #17614] (#4160)S.H2021-02-081-30/+0
|
* Move rb_big_isqrt declarationS-H-GAMELINKS2021-01-311-2/+0
|
* Fix JIT link failuresTakashi Kokubun2021-01-181-8/+2
| | | | forgotten in https://github.com/ruby/ruby/pull/4018
* Improve performance some Float methods [Feature #17498] (#4018)S.H2021-01-011-53/+1
|
* Allow inlining Integer#-@ and #~Takashi Kokubun2020-12-221-30/+4
| | | | | | | | | | | | | | | | | | | | | | ``` $ benchmark-driver -v --rbenv 'before --jit;after --jit' benchmark/mjit_integer.yml --filter '(comp|uminus)' before --jit: ruby 3.0.0dev (2020-12-23T05:41:44Z master 0dd4896175) +JIT [x86_64-linux] after --jit: ruby 3.0.0dev (2020-12-23T06:25:41Z master 8887d78992) +JIT [x86_64-linux] last_commit=Allow inlining Integer#-@ and #~ Calculating ------------------------------------- before --jit after --jit mjit_comp(1) 44.006M 70.417M i/s - 40.000M times in 0.908967s 0.568042s mjit_uminus(1) 44.333M 68.422M i/s - 40.000M times in 0.902255s 0.584603s Comparison: mjit_comp(1) after --jit: 70417331.4 i/s before --jit: 44005980.4 i/s - 1.60x slower mjit_uminus(1) after --jit: 68422468.8 i/s before --jit: 44333371.0 i/s - 1.54x slower ```
* Move docs for Integer#bit_length [ci skip]Alan Wu2020-12-141-45/+0
|
* Remove unused function declarationsS-H-GAMELINKS2020-12-121-4/+0
|
* Fix ArithmeticSequence#last and ArithmeticSequence#each for non-integer ↵Kenta Murata2020-12-091-24/+29
| | | | | | sequences (#3870) [Bug #17218] [ruby-core:100312]
* renameS-H-GAMELINKS2020-11-201-3/+3
|
* fix codeS-H-GAMELINKS2020-11-201-14/+4
|
* add flo_prev_or_next funcS-H-GAMELINKS2020-11-201-8/+21
|
* numeric.c, range.c: prohibit zero stepKenta Murata2020-10-231-3/+6
| | | | | | | | | * numeric.c: prohibit zero step in Numeric#step * range.c: prohibit zero step in Range#step * Fix ruby-spec [Feature #15573]
* Don't redefine #rb_intern over and over againStefan Stüben2020-10-211-6/+3
|
* Hoisted out ensure_cmp which checks the comparison succeededNobuyoshi Nakada2020-10-021-9/+13
|
* Ensure that the comparison succeeded [Bug #17205]Nobuyoshi Nakada2020-10-021-1/+3
|
* Fix unsigned int overflow in error message for chrPeter Zhu2020-09-301-1/+1
| | | | | | | | | | | | | | | | | | The error message has an integer overflow because it treats an unsigned int as a signed int. Before: ``` > 3_000_000_000.chr -1294967296 out of char range (RangeError) ``` After: ``` > 3_000_000_000.chr 3000000000 out of char range (RangeError) ``` Redmine ticket: https://bugs.ruby-lang.org/issues/17186
* [DOC] Use oracle url instead of sun urlS-H-GAMELINKS2020-08-051-1/+1
| | | | [ci skip]
* Use https instead of httpKazuhiro NISHIYAMA2020-07-281-1/+1
|
* fix MJIT link error卜部昌平2020-07-131-1/+1
|
* inline Primitive.cexpr!卜部昌平2020-07-131-0/+12
| | | | | We can obtain the verbatim source code of Primitive.cexpr!. Why not paste that content into the JITed program.