From: Micah Wylde Date: 2007-03-02T10:19:01+09:00 Subject: Re: Floats that are NaN have strange behavior The expected behavior is present in ruby 1.8.4 (2005-12-24), as well. $ ruby -ve 'p [(0.0/0.0).zero?, (0.0/0.0).nonzero?]' ruby 1.8.4 (2005-12-24) [i686-darwin8.8.3] [false, NaN] On 3/1/07, Tadashi Saito wrote: > Hi Jonas, > > On Fri, 2 Mar 2007 03:10:44 +0900 > Jonas Kongslund wrote: > > > I'm playing around with Ruby and noticed the following behavior on the > > float 0.0/0.0 which is NaN: > > > > (0.0/0.0).zero? evaluates to true. I would expect false. > > (0.0/0.0).nonzero? evaluates to nil. I would expect NaN. > > > > Is it a bug? > > I guess so, btw, what's your ruby's version and environment? > `ruby -v` will help. > > Here is my case: > > $ ./ruby-1.8.6/bin/ruby-1.8.6 -ve 'p [(0.0/0.0).zero?, > (0.0/0.0).nonzero?]' > ruby 1.8.6 (2007-02-28 patchlevel 0) [i686-linux] > [false, NaN] > $ ruby-trunk -ve 'p [(0.0/0.0).zero?, (0.0/0.0).nonzero?]' > ruby 1.9.0 (2007-03-01 patchlevel 0) [i686-linux] > [false, NaN] > > -- > Tadashi Saito > > -- Micah Wylde