[ruby-core:78351] [Ruby trunk Bug#12980] Time - Time to return a Rational
From:
mame@...
Date:
2016-11-25 13:31:23 UTC
List:
ruby-core #78351
Issue #12980 has been updated by Yusuke Endoh. I think of one philosophical reason and one practical reason. A philosophical reason: many Time objects are inherently inexact. Since a Rational is considered exact, returning a Rational might convey the wrong message that the Time objects are exact. A practical reason: Time is often used for a simple benchmark tool. Consider "`t = Time.now; ...; p Time.now - t`" prints, such as `(631882841/200000000)` or `(1590642983/500000000)`. It is difficult for human to read and compare the result. ---------------------------------------- Bug #12980: Time - Time to return a Rational https://bugs.ruby-lang.org/issues/12980#change-61723 * Author: Akira Matsuda * Status: Feedback * Priority: Normal * Assignee: Akira Tanaka * ruby -v: ruby 2.4.0dev (2016-11-25 trunk 56897) [x86_64-darwin15] * Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN ---------------------------------------- Currently subtracting a Time from a Time returns a Float, which I guess causes #12952 Is there any reason this doesn't return a Rational? -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>