Burdette Lamar
f98bbb7474
[DOC] Doc for Rational#<=>
2025-12-22 09:12:33 -05:00
BurdetteLamar
2d01406644
[DOC] Harmonize rb_div methods
2025-12-16 17:47:08 -05:00
BurdetteLamar
cfd41cbf03
[DOC] Harmonize #-@ methods
2025-12-15 17:28:35 -05:00
BurdetteLamar
acbf55f4e6
[DOC] Harmonize #- methods
2025-12-15 17:27:54 -05:00
BurdetteLamar
7fbf321d23
[DOC] Harmonize #** methods
2025-12-15 17:27:24 -05:00
Burdette Lamar
b2f110651c
[DOC] Harmonize #+ methods
2025-12-02 21:39:25 -05:00
BurdetteLamar
b47b37c12c
[DOC] Harmonize #* methods
2025-11-21 14:11:54 -08:00
Burdette Lamar
14e75435ea
[DOC] Tweaks for String#to_r
2025-11-12 05:13:29 -05:00
Hartley McGuire
8120971932
Move more NilClass methods to ruby
...
```
$ make benchmark ITEM=nilclass COMPARE_RUBY="/opt/rubies/ruby-master/bin/ruby"
/opt/rubies/3.4.2/bin/ruby --disable=gems -rrubygems -I../benchmark/lib ../benchmark/benchmark-driver/exe/benchmark-driver \
--executables="compare-ruby::/opt/rubies/ruby-master/bin/ruby -I.ext/common --disable-gem" \
--executables="built-ruby::./miniruby -I../lib -I. -I.ext/common ../tool/runruby.rb --extout=.ext -- --disable-gems --disable-gem" \
--output=markdown --output-compare -v $(find ../benchmark -maxdepth 1 -name 'nilclass' -o -name '*nilclass*.yml' -o -name '*nilclass*.rb' | sort)
compare-ruby: ruby 3.5.0dev (2025-06-02T13:52:25Z master cbd49ecbbe) +PRISM [arm64-darwin24]
built-ruby: ruby 3.5.0dev (2025-06-02T22:47:21Z hm-ruby-nilclass 3e7f1f0466) +PRISM [arm64-darwin24]
| |compare-ruby|built-ruby|
|:------------|-----------:|---------:|
|rationalize | 24.056M| 53.908M|
| | -| 2.24x|
|to_c | 23.652M| 82.781M|
| | -| 3.50x|
|to_i | 89.526M| 84.388M|
| | 1.06x| -|
|to_f | 84.746M| 96.899M|
| | -| 1.14x|
|to_r | 25.107M| 83.472M|
| | -| 3.32x|
|splat | 42.772M| 42.717M|
| | 1.00x| -|
```
This makes them much faster
2025-06-12 09:30:09 +02:00
Nobuyoshi Nakada
b4ec22fe6c
[DOC] Exclude 'Method' from RDoc's autolinking
2025-01-02 12:23:49 +09:00
Yusuke Endoh
45cd4a8296
Do not round a**b to infinity
...
... instead, just calculate the value unless it is too big.
Also, this change raises an ArgumentError if it is expected to exceed
16 GB in a 64-bit environment.
(It is possible to calculate it straightforward, but it would likely be
out-of-memory, so I didn't think it would make sense.)
[Feature #20811 ]
2024-11-08 19:48:56 +09:00
Nobuyoshi Nakada
f8e3dd4ec1
[Bug #20524 ] win32: Suppress GMP warning
...
```
C:\vcpkg\installed\x64-windows\include\gmp.h(2237): warning C4146: unary minus operator applied to unsigned type, result still unsigned
```
2024-06-05 18:01:28 +09:00
Jean Boussier
f06670c5a2
Eliminate usage of OBJ_FREEZE_RAW
...
Previously it would bypass the `FL_ABLE` check, but
since shapes introduction, it started having a different
behavior than `OBJ_FREEZE`, as it would onyl set the `FL_FREEZE`
flag, but not update the shape.
I have no indication of this causing a bug yet, but it seems
like a trap waiting to happen.
2024-04-16 17:20:35 +02:00
Peter Zhu
9a2b692249
Replace assert with RUBY_ASSERT in rational.c
...
assert does not print the bug report, only the file and line number of
the assertion that failed. RUBY_ASSERT prints the full bug report, which
makes it much easier to debug.
2024-02-12 15:07:47 -05:00
Matt Valentine-House
026321c5b9
[Feature #19474 ] Refactor NEWOBJ macros
...
NEWOBJ_OF is now our canonical newobj macro. It takes an optional ec
2023-04-06 11:07:16 +01:00
Burdette Lamar
1a8a24a633
[DOC] Enhanced RDoc for NilClass ( #7500 )
2023-03-13 12:55:59 -04:00
BurdetteLamar
3b239d2480
Remove (newly unneeded) remarks about aliases
2023-02-19 14:26:34 -08:00
S-H-GAMELINKS
1f4f6c9832
Using UNDEF_P macro
2022-11-16 18:58:33 +09:00
S.H
c6f439a6a8
Improve performance some Integer and Float methods [Feature #19085 ] ( #6638 )
...
* Improve some Integer and Float methods
* Using alias and Remove unnecessary code
* Remove commentout code
2022-10-27 09:13:16 -07:00
Takashi Kokubun
5b21e94beb
Expand tabs [ci skip]
...
[Misc #18891 ]
2022-07-21 09:42:04 -07:00
Nobuyoshi Nakada
a080651f46
Disable GMP by -DUSE_GMP=0
2022-05-20 19:05:35 +09:00
Nobuyoshi Nakada
16fdc1ff46
[DOC] Fix broken links to literals.rdoc
2022-02-08 01:27:52 +09:00
Nobuyoshi Nakada
bc5662d9d8
[DOC] Simplify links to global methods
2022-02-08 01:18:56 +09:00
Burdette Lamar
28fb6d6b9e
Adding links to literals and Kernel ( #5192 )
...
* Adding links to literals and Kernel
2021-12-03 07:12:28 -06:00
S-H-GAMELINKS
032534dbdf
Using RB_BIGNUM_TYPE_P macro
2021-09-11 09:13:24 +09:00
Nobuyoshi Nakada
137fde717b
Make internal predicate functions to return simple boolean
2021-09-02 17:43:10 +09:00
S-H-GAMELINKS
a826747ade
Remove unneeded comments in rational.c
2021-08-31 20:57:33 +09:00
Nobuyoshi Nakada
04be8e84db
Use C99-defined macros to classify a floating-point number
2021-08-27 12:41:30 +09:00
S.H
58bd943436
Replace f_boolcast with RBOOL macro
...
* Move f_boolcast definination
* Remove f_boolcast macro defination
* to
2021-08-18 02:25:19 +09:00
Jeremy Evans
d16b68cb22
Use Rational for Float#round with ndigits > 14
...
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>
2021-08-06 15:03:51 -07:00
Nobuyoshi Nakada
6329da588b
Use predefined IDs
2021-07-27 15:40:27 +09:00
卜部昌平
2bc293e899
cdhash_cmp: can take rational literals
...
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 ]
2021-05-12 10:30:46 +09:00
Nobuyoshi Nakada
9efd590a13
Rationalize floats in coerce [Bug #17572 ]
2021-01-23 11:13:21 +09:00
Nobuyoshi Nakada
a55eb9a2af
Make reciprocal properly of non-integral rational [Bug #17572 ]
2021-01-23 10:30:59 +09:00
Nobuyoshi Nakada
184e82e8f0
Follow the NDEBUG given to the whole
2021-01-07 16:52:10 +09:00
Kenta Murata
fad3023e94
Fix ArithmeticSequence#last and ArithmeticSequence#each for non-integer sequences ( #3870 )
...
[Bug #17218 ]
[ruby-core:100312]
2020-12-09 18:48:59 +09:00
Nobuyoshi Nakada
b958e2add8
Removed canonicalization for mathn
2020-11-10 11:14:15 +09:00
Kenta Murata
69837229d7
rational.c: convert a numerator to rational before calling fdiv in Kernel.Rational() ( #3702 )
...
This makes `Rational(BigDecimal(1), 60) == Rational(1, 60)`.
[Bug #16518 ]
2020-10-26 18:43:30 +09:00
Kenta Murata
d23d5c3130
rational.c: try converting by to_int in Rational() ( #3684 )
...
[Bug #12485 ]
2020-10-22 17:59:52 +09:00
Stefan Stüben
8c2e5bbf58
Don't redefine #rb_intern over and over again
2020-10-21 12:45:18 +09:00
卜部昌平
ff30358d13
RARRAY_AREF: convert into an inline function
...
RARRAY_AREF has been a macro for reasons. We might not be able to
change that for public APIs, but why not relax the situation internally
to make it an inline function.
2020-08-15 12:09:26 +09:00
Nobuyoshi Nakada
49029811d9
Reduced working Rational object allocations
...
When rationalizing negative values.
2020-07-01 22:41:16 +09:00
Nobuyoshi Nakada
254bed3027
Renamed nurat_sub compliant with rb_rational_plus
2020-07-01 22:41:15 +09:00
Nobuyoshi Nakada
53d2bfd540
Added a few integer case short-circuits
2020-07-01 22:41:15 +09:00
Nobuyoshi Nakada
29ecce4d72
Replaced f_odd_p with rb_int_odd_p
2020-07-01 22:41:14 +09:00
卜部昌平
689dd3aecb
parse_rat: do not goto into a branch
...
I'm not necessarily against every goto in general, but jumping into a
branch is definitely a bad idea. Better refactor.
2020-06-29 11:05:41 +09:00
卜部昌平
d7eec15f8e
rb_rational_cmp: do not goto into a branch
...
I'm not necessarily against every goto in general, but jumping into a
branch is definitely a bad idea. Better refactor.
2020-06-29 11:05:41 +09:00
卜部昌平
9e41a75255
sed -i 's|ruby/impl|ruby/internal|'
...
To fix build failures.
2020-05-11 09:24:08 +09:00
卜部昌平
d7f4d732c1
sed -i s|ruby/3|ruby/impl|g
...
This shall fix compile errors.
2020-05-11 09:24:08 +09:00
卜部昌平
32623150cd
reroute redefinition of NDEBUG
...
NDEBUG can be defined via a command-line argument. Should take care of
such situations.
2020-04-21 13:07:19 +09:00