aboutsummaryrefslogtreecommitdiffstats
path: root/numeric.c
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* add UNREACHABLE_RETURN卜部昌平2020-06-291-0/+1
| | | | | | Not every compilers understand that rb_raise does not return. When a function does not end with a return statement, such compilers can issue warnings. We would better tell them about reachabilities.
* fix_pow: do not goto into a branch卜部昌平2020-06-291-31/+26
| | | | | I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
* int_pow: do not goto into a branch卜部昌平2020-06-291-7/+9
| | | | | I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
* flo_to_s: do not goto into a branch卜部昌平2020-06-291-11/+14
| | | | | I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
* Mark some Integer methods as inline (#3264)Takashi Kokubun2020-06-271-73/+0
|
* Make Integer#zero? a separated method and builtin (#3226)Takashi Kokubun2020-06-201-7/+17
| | | | | | | A prerequisite to fix https://bugs.ruby-lang.org/issues/15589 with JIT. This commit alone doesn't make a significant difference yet, but I thought this commit should be committed independently. This method override was discussed in [Misc #16961].
* Remove unused else if statements in int_even_p func (#3220)S.H2020-06-161-10/+6
| | | | | | | * remove else if & rb_funcall * fix int_even_p impl * fix rb_int_odd_p implementation
* Add static modifier for rb_int_ceil & rb_int_floor (#3217)S.H2020-06-161-4/+4
|
* numeric.c: optimize `float ** 2` case by fastpathYusuke Endoh2020-05-121-1/+5
| | | | | | It would be a relatively frequent case. It is still slower than `float * float` because `*` has a dedicated VM instruction (opt_mult), though.
* sed -i 's|ruby/impl|ruby/internal|'卜部昌平2020-05-111-1/+1
| | | | To fix build failures.
* sed -i s|ruby/3|ruby/impl|g卜部昌平2020-05-111-1/+1
| | | | This shall fix compile errors.
* Added more NORETURN declarationsNobuyoshi Nakada2020-05-111-0/+2
|
* numeric.c: Remove unreachable codeYusuke Endoh2020-04-091-4/+1
| | | | b cannot be <= 0 here. Found by Coverity Scan
* Suppress C4244 "possible loss of data" warningsNobuyoshi Nakada2020-04-081-1/+1
|
* Suppress -Wswitch warningsNobuyoshi Nakada2020-04-081-0/+2
|
* Merge pull request #2991 from shyouhei/ruby.h卜部昌平2020-04-081-4/+16
| | | Split ruby.h
* Removed non-RUBY_INTEGER_UNIFICATION codeNobuyoshi Nakada2020-03-211-6/+0
|
* Remove Float::ROUNDSJeremy Evans2020-03-091-20/+0
| | | | Fixes [Bug #16044]
* Check the encoding of `half:` optionNobuyoshi Nakada2020-01-271-0/+1
|
* decouple internal.h headers卜部昌平2019-12-261-4/+18
| | | | | | | | | | | | | | | | | | 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).
* add several __has_something macro卜部昌平2019-12-261-11/+11
| | | | | | | With these macros implemented we can write codes just like we can assume the compiler being clang. MSC_VERSION_SINCE is defined to implement those macros, but turned out to be handy for other places. The -fdeclspec compiler flag is necessary for clang to properly handle __has_declspec().
* make functions static卜部昌平2019-11-191-3/+4
| | | | | | | These functions are used from within a compilation unit so we can make them static, for better binary size. This changeset reduces the size of generated ruby binary from 26,590,128 bytes to 26,584,472 bytes on my macihne.
* Use FIX2LONG instead of FIX2INT like 26843cbcd0NARUSE, Yui2019-11-071-4/+4
|
* Use FIX2LONG to avoid unexpected exceptionNARUSE, Yui2019-11-071-1/+1
| | | | | Though it won't happen in the real world in this context, FIX2INT may raise an exception and it cause to generate extra code.
* Suppress keyword argument warning from #stepNobuyoshi Nakada2019-09-301-1/+1
| | | | | | * numeric.c (num_step): pass the extracted argument from keyword argument, not the last argument itself which should have been warned already.
* Inspect dynamic symbol as well as static symbolNobuyoshi Nakada2019-08-251-1/+1
|
* Expanded f_quoNobuyoshi Nakada2019-08-101-3/+3
|
* Deprecate Float::ROUNDS, which should not be a constantNobuyoshi Nakada2019-08-071-1/+4
| | | | [Bug #16044]
* Predefine some IDsNobuyoshi Nakada2019-08-031-7/+6
|
* Expanded f_ceilNobuyoshi Nakada2019-08-021-1/+8
|
* Adjust styles and indentsNobuyoshi Nakada2019-07-191-1/+2
|
* numeric.c (fix_cmp): remove a unreachable return statementYusuke Endoh2019-07-141-1/+0
|
* * expand tabs.git2019-07-141-1/+1
|
* Prefer `rb_error_arity` to `rb_check_arity` when it can be usedYusuke Endoh2019-07-141-2/+1
|
* Make opt_aref instruction support Integer#[]Yusuke Endoh2019-06-011-3/+3
| | | | | | | | | | | | only when its receiver and the argument are both Integers. Since 6bedbf4625, Integer#[] has supported a range extraction. This means that Integer#[] now accepts multiple arguments, which made the method very slow unfortunately. This change fixes the performance issue by adding a special handling for its traditional use case: `num[idx]` where both `num` and `idx` are Integers.
* Update broken URL in Float documentation.Hiroshi SHIBATA2019-05-041-1/+1
| | | | [Misc #15775][ruby-core:92332]
* * expand tabs.git2019-04-281-4/+4
|
* numeric.c: Extend Integer#[] to support range argumentsYusuke Endoh2019-04-281-23/+125
| | | | | | | | | | | ```` 0b01001101[2, 4] #=> 0b0011 0b01001100[2..5] #=> 0b0011 0b01001100[2...6] #=> 0b0011 ^^^^ ```` [Feature #8842]
* numeric.c: fix infinite loopnobu2019-03-111-0/+1
| | | | | | | | * numeric.c (int_pow): fix infinite loop in the case of y equal 1 and power of x does not overflow. [ruby-core:91734] [Bug #15651] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* enumerator.c: fix arith_seq_first for Infinitymrkn2019-01-301-1/+1
| | | | | | | | | | | | | | * enumerator.c (arith_seq_first): fix for Float::INFINITY. * test/ruby/test_arithmetic_sequence.rb: add tests. * numeric.c (ruby_float_step_size): export for internal use. * internal.h: add prototype declaration of ruby_float_step_size. [ruby-core:90937][Bug #15518] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66947 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * expand tabs.svn2019-01-241-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66915 b2dd03c8-39d4-4d8f-98ff-823fe69b080e