summaryrefslogtreecommitdiff
path: root/internal/rational.h
Commit message (Collapse)AuthorAgeFilesLines
* Don't redefine RB_OBJ_WRITEPeter Zhu2023-01-181-1/+0
| | | | | RB_OBJ_WRITE already exists in rgengc.h, so we shouldn't redefine it in gc.h.
* internal/*.h: skip doxygen卜部昌平2021-09-101-1/+0
| | | | | These contents are purely implementation details, not worth appearing in CAPI documents. [ci skip]
* Use Rational for Float#round with ndigits > 14Jeremy Evans2021-08-061-0/+1
| | | | | | | | | | | 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>
* cdhash_cmp: can take rational literals卜部昌平2021-05-121-0/+1
| | | | | | | Rational literals are those integers suffixed with `r`. They tend to be a part of more complex expressions like `123/456r`, but in theory they can live alone. When such "bare" rational literals are passed to case-when branch, we have to take care of them. Fixes [Bug #17854]
* Fix ArithmeticSequence#last and ArithmeticSequence#each for non-integer ↵Kenta Murata2020-12-091-0/+2
| | | | | | sequences (#3870) [Bug #17218] [ruby-core:100312]
* include/ruby/backward/2/r_cast.h: deprecate卜部昌平2020-08-271-1/+1
| | | | | Remove all usages of RCAST() so that the header file can be excluded from ruby/ruby.h's dependency.
* Renamed `nurat_sub` compliant with `rb_rational_plus`Nobuyoshi Nakada2020-07-011-0/+1
|
* 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.
* add #include guard hack卜部昌平2020-04-131-3/+3
| | | | | | | | | | | | | | | | | | | | | | According to MSVC manual (*1), cl.exe can skip including a header file when that: - contains #pragma once, or - starts with #ifndef, or - starts with #if ! defined. GCC has a similar trick (*2), but it acts more stricter (e. g. there must be _no tokens_ outside of #ifndef...#endif). Sun C lacked #pragma once for a looong time. Oracle Developer Studio 12.5 finally implemented it, but we cannot assume such recent version. This changeset modifies header files so that each of them include strictly one #ifndef...#endif. I believe this is the most portable way to trigger compiler optimizations. [Bug #16770] *1: https://docs.microsoft.com/en-us/cpp/preprocessor/once *2: https://gcc.gnu.org/onlinedocs/cppinternals/Guard-Macros.html
* Merge pull request #2991 from shyouhei/ruby.h卜部昌平2020-04-081-6/+6
| | | Split ruby.h
* internal/rational.h: insert assertions in RATIONAL_SET_{NUM,DEN}Kenta Murata2020-01-171-0/+5
|
* Make RATIONAL_SET_{NUM,DEN} static inline functionsKenta Murata2020-01-171-2/+16
|
* other minior internal header tweaks卜部昌平2019-12-261-2/+4
| | | | | | | | These headers need no rewrite. Just add some minor tweaks, like addition of #include lines. Mainly cosmetic. TIMET_MAX_PLUS_ONE was deleted because the macro was used from only one place (directly write expression there).
* split internal.h into files卜部昌平2019-12-261-0/+47
One day, I could not resist the way it was written. I finally started to make the code clean. This changeset is the beginning of a series of housekeeping commits. It is a simple refactoring; split internal.h into files, so that we can divide and concur in the upcoming commits. No lines of codes are either added or removed, except the obvious file headers/footers. The generated binary is identical to the one before.