From: Dan Doel Date: 2003-08-12T11:16:41+09:00 Subject: Re: NaN and Inifinity Scott Thompson wrote: >> irb(main):015:0> a = Math::log(-1) >> => NaN >> irb(main):016:0> a.class >> => Float >> irb(main):017:0> b = "NaN".to_f >> => NaN >> irb(main):018:0> b.class >> => Float >> irb(main):019:0> b.nan? >> => true > > > Hrrrm... Okee dokey. I tried something like that and I get > > irb(main):002:0> b = "NaN".to_f > => 0.0 > irb(main):003:0> b.nan? > => false > > There must be something wacky with my Ruby. :-) > > Scott It's not just you. Happens to me, too, using Ruby 1.8.0pre9 (I believe) mswin32 build. Then again, Math::log(-1) throws a domain error for me. If worse comes to worst you could always initialize with Math::log(-1), since that returns what you want. - Dan