Граф коммитов

878 Коммитов

Автор SHA1 Сообщение Дата
BurdetteLamar 8cad6fc90a Tweak to Integer What's Here 2024-01-06 13:25:17 -05:00
BurdetteLamar 4a44bf8c34 Tweak to Float What's Here 2024-01-06 13:24:48 -05:00
BurdetteLamar 7b615bfdf3 Tweak to Float What's Here 2024-01-06 13:24:48 -05:00
Peter Zhu d96fe5e4f8 [DOC] Fix indentation in Numeric#step 2024-01-06 11:43:57 -05:00
Peter Zhu 0831d960bf [DOC] Fix typo in call-seq for Float#round 2024-01-06 09:34:54 -05:00
Peter Zhu 6934a60ab1 [DOC] Fix alignment of values for Integer#div 2024-01-01 11:14:42 -05:00
Peter Zhu c0481e5818 [DOC] Fix indentation for Integer#div
The line was indented, which caused it to be treated as a code block.
2024-01-01 11:12:54 -05:00
Peter Zhu 606c01727a [DOC] Fix indentation for Numeric#step
The documentation was indented one level too deep, which causes RDoc to
generate it all as a code block.
2023-12-29 13:13:17 -05:00
Peter Zhu 550a49c913 [DOC] Fix documentation for Numeric#eql?
+==+ does not format properly, so we should use <tt>==</tt> instead.
2023-12-26 10:48:48 -05:00
John Hawthorn 0c3593b657 Use free with ruby_dtoa
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.
2023-12-07 09:23:02 -08:00
Nobuyoshi Nakada 8e93bf8e1f
[Bug #17037] Improve accuracy of division near precision limits
When dividing near the precision limit of `double`, use Bignum
division to get rid of rounding errors.
2023-11-29 20:16:36 +09:00
Kouhei Yanagita 5cb76754ab [DOC] Fix the argument name in the Numeric#step doc 2023-10-15 13:47:58 +09:00
Kouhei Yanagita b28c1d2c56 [Bug #19926] Fix Range#size for ranges with a Rational endpoint 2023-10-14 11:22:42 +09:00
Nobuyoshi Nakada 50520cc193
[DOC] Missing comment markers 2023-09-27 16:18:05 +09:00
Takashi Kokubun 5b5ae3d9e0
Rewrite Integer#times in Ruby (#8388) 2023-09-07 10:57:52 -07:00
BurdetteLamar 3080cf3dec [DOC] Don't suppress autolinks 2023-08-13 15:47:12 -04:00
Burdette Lamar 6528cf9fcf
[DOC] Fixes for link fragments (#7981) 2023-06-28 09:05:43 -04:00
Peter Zhu b7a26dfa16 Unify error messages of rb_num2ulong and rb_num2ull
The error messages were slightly different due, which causes different
behaviour on 32-bit and 64-bit systems.
2023-05-29 11:55:39 -04: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
Takashi Kokubun 233ddfac54 Stop exporting symbols for MJIT 2023-03-06 21:59:23 -08:00
BurdetteLamar 3b239d2480 Remove (newly unneeded) remarks about aliases 2023-02-19 14:26:34 -08:00
Nobuyoshi Nakada dd28c55a7c
[Bug#19445] Fix keyword splat in enumerator
Extracted arguments do not have keyword hash to splat.
2023-02-17 10:57:22 +09:00
Takashi Kokubun 344c16eba4
Avoid using a weird syntax for documentation
Following up 465bd972ec.

If the actual implementation still resides in C, it should be
documented in C just like all other places.
2023-01-30 13:18:19 -08:00
Nobuyoshi Nakada 71ce7e1825
[Bug #19335] `Integer#remainder` should respect `#coerce` (#7120)
Also `Numeric#remainder` should.
2023-01-15 13:03:27 +09:00
Kenta Murata 9f2378959e
numeric.c: Fix round_half_even for specific values (#7023)
Handle the integert and the float parts separately in round_half_even
to prevent error occursions in floating point calculation.
2022-12-26 21:02:47 +09:00
S-H-GAMELINKS 1f4f6c9832 Using UNDEF_P macro 2022-11-16 18:58:33 +09:00
Nobuyoshi Nakada 5ccb625fbb
Use `roomof` macro for rounding up divisions 2022-10-14 19:23:25 +09:00
Kouhei Yanagita 803a072630 Improve performance of Integer#ceildiv
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)
```
2022-08-12 15:57:52 +09:00
Kouhei Yanagita 24e33b84b5 Remove Numeric#ceildiv 2022-08-12 15:57:52 +09:00
Kouhei Yanagita 4165fd0e76 Add Numeric#ceildiv and Integer#ceildiv 2022-08-12 15:57:52 +09:00
Takashi Kokubun 5b21e94beb Expand tabs [ci skip]
[Misc #18891]
2022-07-21 09:42:04 -07:00
Kouhei Yanagita a4721ec6cd [DOC] Fix documentation of Numeric#div: Complex does not have #div 2022-06-03 14:35:47 +09:00
Kouhei Yanagita 8b4d2a5014
[DIC] Fix typo in documentation 2022-05-27 20:18:54 +09:00
Grant Hutchins 59c81274aa Use correct capitalization of "NaN" in docs 2022-04-13 15:44:36 -04:00
Nobuyoshi Nakada 300f4677c9
[DOC] Use simple references to operator methods
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.
2022-03-26 21:13:16 +09:00
Burdette Lamar 7f93b7dc88
[DOC] Fix formatting for What's Here in IO (#5719)
* 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
2022-03-25 15:43:46 -05:00
Koichi ITO 045ab1d056 [DOC] Fix a typo in `Integer#chr` example
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"
```
2022-02-13 15:48:01 +09:00
Nobuyoshi Nakada 50c972a1ae
[DOC] Simplify operator method references 2022-02-12 12:38:36 +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
Peter Zhu a32e5e1b97 [DOC] Use RDoc link style for links in the same class/module
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
2022-02-07 09:52:06 -05:00
Peter Zhu f9a2802bc5 [DOC] Use RDoc link style for links to other classes/modules
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
2022-02-07 09:52:06 -05:00
Nobuyoshi Nakada 6a6227e016 Shifting zero always results in zero [Bug #18517] 2022-01-27 14:00:33 +09:00
Nobuyoshi Nakada 069cca6f74
Negative RBOOL usage 2022-01-01 17:02:04 +09:00
Nobuyoshi Nakada 77ee47188e
Make the internal predict `int_zero_p` return a bool 2022-01-01 17:01:40 +09:00
Nobuyoshi Nakada 40e7aefeba Remove obsolete Fixnum and Bignum 2021-12-28 18:35:03 +09:00
Nobuyoshi Nakada 454b4da763
[DOC] Integer.try_convert [ci skip] 2021-12-08 17:59:16 +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
Jeremy Evans fe1725236c Don't call + and < in Integer.times for !FIXNUM
The methods aren't called for FIXNUM, and it's best to have
consistent behavior.

Fixes [Bug #18377]
2021-12-01 16:21:50 -08:00
Burdette Lamar eac7c63538
Enhanced RDoc for numeric.c (#5184)
Adds remarks about literals and Kernel methods to Float and Integer.
2021-11-27 13:07:37 -06:00