General

Profile

ankane (Andrew Kane)

  • Login: ankane
  • Registered on: 05/15/2020
  • Last sign in: 09/16/2025

Issues

open closed Total
Assigned issues 0 0 0
Reported issues 2 0 2

Activity

09/20/2021

04:09 AM Ruby Feature #18179 (Open): Add Math methods to Numeric
Hi, I wanted to get thoughts on adding class methods from `Math` as instance methods on `Numeric`.
```ruby
x.sqrt # vs Math.sqrt(x)
x.log # vs Math.log(x)
```
Rust takes this approach and it (subjectively) feels more intuitive/...
ankane (Andrew Kane)

05/16/2020

01:43 AM Ruby Feature #16894: Integer division for Ruby 3
fwiw, array indexing code likely wouldn't need changed.
``` ruby
a = ["zero", "one", "two"]
a[1/2] # "zero"
a[1/2.0] # "zero"
```
Some code would break, but we have major versions to account for this. It seems like a smaller ...
ankane (Andrew Kane)

05/15/2020

09:52 AM Ruby Feature #16894: Integer division for Ruby 3
Here's a good read on the thoughts and motivation behind Python changing it: https://www.python.org/dev/peps/pep-0238/ ankane (Andrew Kane)
04:39 AM Ruby Feature #16894: Integer division for Ruby 3
Thanks for the responses!
Re 0.5 vs 1/2r: In my experience, developers use floats way more than rationals.
Re "is it worth the incompatibility?": I like to imagine it's not confusing new developers 20 years for now. If it's a chang...
ankane (Andrew Kane)
03:29 AM Ruby Feature #16894: Integer division for Ruby 3
Sorry, for the edits, first issue! Changed normal to floating point. ankane (Andrew Kane)
03:20 AM Ruby Feature #16894 (Assigned): Integer division for Ruby 3
Hi Ruby team,
It'd be great if division in Ruby matched what we all learned in school.
``` ruby
1 / 2 == 0.5
```
New developers wouldn't immediately be confused when they try to do division and experienced developers could sto...
ankane (Andrew Kane)

Also available in: Atom