From: Rob Biedenharn Date: 2010-08-12T01:15:48+09:00 Subject: Re: [OT] String#to_r (was: "NaN".to_f revisited) On Aug 11, 2010, at 11:28 AM, Fela Winkelmolen wrote: >> Might give some strange behaviour though: >> >> "1$".to_f => 1.0 >> "nonsense".to_f => 0.0 >> "nanotubes".to_f => Nan ? >> "inferiority".to_f => Inf ? > > well, it's not so much "stranger" than the following I suppose > > "24/7".to_f => 24.0 > On 1.9, try: irb> "24/7".to_r => (24/7) irb> _.class => Rational -Rob Rob Biedenharn Rob@AgileConsultingLLC.com http://AgileConsultingLLC.com/ rab@GaslightSoftware.com http://GaslightSoftware.com/