Time - Time to return a Rational
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?
#3 [ruby-core:78344] Updated by akr (Akira Tanaka) about 1 year ago
It is because ruby-dev:38446 by mame-san.
#5 [ruby-core:78351] Updated by mame (Yusuke Endoh) about 1 year ago
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
(1590642983/500000000). It is difficult for human to read and compare the result.