Issue #16894 has been updated by shan (Shannon Skipper).


I'd really rather not deal with Floats unless absolutely necessary.

Raku (Perl 6) and Clojure's default division to a rational seems really nic=
e. I especially like how Raku's just appear as decimal digits.

nobu (Nobuyoshi Nakada) wrote in #note-15:
> Just FYI, I've made these patches for division recently.
> https://github.com/ruby/ruby/compare/master...nobu:feature/fract-slash?ex=
pand=3D1
> https://github.com/ruby/ruby/compare/master...nobu:feature/division?expan=
d=3D1

That's fun! It took me a few minutes longer than I anticipated to get "=F7"=
 working in my terminal. :)

----------------------------------------
Feature #16894: Integer division for Ruby 3
https://bugs.ruby-lang.org/issues/16894#change-85684

* Author: ankane (Andrew Kane)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
----------------------------------------
Hi Ruby team,

It'd be great if division in Ruby matched what we all learned in school.

``` ruby
1 / 2 =3D=3D 0.5
```

New developers wouldn't immediately be confused when they try to do divisio=
n and experienced developers could stop adding to_f to their code (typicall=
y after they get tripped up on the first run). In my experience, floating p=
oint division is way more common than floor division. This could definitely=
 break existing code, so I understand it's a decision that shouldn't be mad=
e lightly. Overall, Ruby is really intuitive, but this is one place where i=
t's not.

It looks like this was considered for Ruby 2.0 as well as few years ago in =
#5512, so feel free to close if it's not something you'd like to reconsider=
 right now.

---Files--------------------------------
integer division.png (14.3 KB)


-- =

https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=3Dunsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>