From: nobu.nokada@... Date: 2003-03-22T04:40:22+09:00 Subject: Re: infinite Time Hi, At Sat, 22 Mar 2003 03:44:31 +0900, ahoward wrote: > > On Sat, 22 Mar 2003 nobu.nokada@softhome.net wrote: > > > class Time > > NEGATIVE_INFINITY = -1.0 / 0 > > INFINITY = 1.0 / 0 > > EPOCH = 0 > > end > > looks promising. however, can anyone explain why this approach to > implementing the comparisions does not work????? You need to coerce. class Time def coerce(x) case x when Float return [x, to_f] when Integer return [x, to_i] else super end end INF = INFINITY = 1.0 / 0 NINF = NEGATIVE_INFINITY = -1.0 / 0 EPOCH = Time.at(0) end > i am unclear as to why > > class << object > include Comparable > def <=> ... > end > > does NOT, in this case, seem to redefine the '>' operator. Float#> doesn't call <=> due to performance. -- Nobu Nakada