From: "Kurt M. Dresner" Date: 2003-08-12T11:29:18+09:00 Subject: Re: NaN and Inifinity The other thing you might want to consider is how useful this would be. You can't compare NaNs, as far as I know. 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> a == b => false irb(main):020:0> a => NaN irb(main):021:0> b => NaN irb(main):022:0> a == a => false -Kurt On Tue, Aug 12, 2003 at 11:26:58AM +0900, Hal E. Fulton wrote: > ----- Original Message ----- > From: "Mike Stok" > Newsgroups: comp.lang.ruby > To: "ruby-talk ML" > Sent: Monday, August 11, 2003 9:21 PM > Subject: Re: NaN and Inifinity > > > > In article , > > Scott Thompson wrote: > > >If I do something like > > > > > >a = Math::log(-1) > > > > > >then a properly takes the value NaN. > > > > > >Is there any way to explicitly assign the variable "a" to NaN (or > > >Inifinity or -Infinity) to begin with? I tried finding "NaN" as a > > >constant but couldn't locate it. It doesn't appear to be a constant in > > >Float or Math. > > module Math > Nan = log(-1) > end > > Now it is. :) > > Hal > > >======= End of Original Message =======<