[#111472] [Ruby master Bug#19274] Error installing ruby 3.2.0 on RH 8 — "aalllop (Alberto Allegue) via ruby-core" <ruby-core@...>
Issue #19274 has been reported by aalllop (Alberto Allegue).
5 messages
2022/12/28
[#111508] Data support for versions before 3.2.0 — Eustáquio Rangel via ruby-core <ruby-core@...>
I was wondering that every piece of code (gems, etc) that use the new Data =
3 messages
2022/12/29
[ruby-core:111274] [Ruby master Bug#19231] Integer#step and Float::INFINITY - inconsistent behaviour when called with and without a block
From:
"Eregon (Benoit Daloze)" <noreply@...>
Date:
2022-12-13 18:14:12 UTC
List:
ruby-core #111274
Issue #19231 has been updated by Eregon (Benoit Daloze).
IMHO Integer makes sense so one can step by N from 0 to infinity with `0.step(Float::INFINITY, 10)` (with `Numeric#step`), since there is no `Integer::INFINITY`.
Using Float also can cause significant errors with a big enough step or values.
So the rule would be "use floats if `receiver` or `step` is Float (ignore `to/limit`'s type), otherwise leave them as-is.
The keyword form already uses integers for "step infinitely":
```ruby
> 0.step(by: 10).take 2
=> [0, 10]
> 0.step(by: 10) { break _1 }
=> 0
```
Probably we need to be consistent with `Range#step` too:
```ruby
> (0..).step(10) { break _1 }
=> 0
> (0..).step(10).take 2
=> [0, 10]
> (0..Float::INFINITY).step(10) { break _1 }
=> 0.0
> (0..Float::INFINITY).step(10).take 2
=> [0.0, 10.0]
```
----------------------------------------
Bug #19231: Integer#step and Float::INFINITY - inconsistent behaviour when called with and without a block
https://bugs.ruby-lang.org/issues/19231#change-100625
* Author: andrykonchin (Andrew Konchin)
* Status: Open
* Priority: Normal
* ruby -v: 3.1.2
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
The initial issue was reported here https://github.com/oracle/truffleruby/issues/2797.
`0.step(Float::INFINITY, 10)` returns:
- `Integers` when called with a block
- `Floats` when called without a block
I would expect `Floats` to be returned in both cases.
Examples:
```ruby
0.step(Float::INFINITY, 10).take(1).map(&:class)
=> [Float]
```
```ruby
0.step(Float::INFINITY, 10) { |offset| p offset.class; break }
# Integer
```
When `to` argument is a finite `Float` value then calling with a block returns `Floats` as well:
```ruby
0.step(100.0, 10) { |offset| p offset.class; break }
# Float
```
Wondering whether it's intentional behaviour.
I've found a related issue https://bugs.ruby-lang.org/issues/15518.
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- [email protected]
To unsubscribe send an email to [email protected]
ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/