From: shevegen@... Date: 2020-05-18T15:41:12+00:00 Subject: [ruby-core:98427] [Ruby master Feature#16894] Integer division for Ruby 3 Issue #16894 has been updated by shevegen (Robert A. Heiler). I am not necessarily against such a change per se, but I think it would come with a high cost right now. It should perhaps be discussed more for ruby 4.0 or so. By the way, mruby behaves in a similar way. Matz explained that years ago in a video. :) For example, if you do start mirb, and do this right now: 1/2 # => 0.5 So in some ways MRI would sync towards mruby here. ;) But as said, I think if this were to be changed for MRI, I would recommend a long transition time, so perhaps a discussion for this at ruby ~3.2 or so (hard to predict the future!). ---------------------------------------- Feature #16894: Integer division for Ruby 3 https://bugs.ruby-lang.org/issues/16894#change-85699 * 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 == 0.5 ``` New developers wouldn't immediately be confused when they try to do division and experienced developers could stop adding to_f to their code (typically after they get tripped up on the first run). In my experience, floating point 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 made lightly. Overall, Ruby is really intuitive, but this is one place where it'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: