From: Jonas Kongslund Date: 2007-03-02T18:13:31+09:00 Subject: Re: Floats that are NaN have strange behavior Tadashi Saito skrev: > 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] C:\...>ruby -ve 'p [(0.0/0.0).zero?, (0.0/0.0).nonzero?]' ruby 1.8.5 (2006-08-25) [i386-mswin32] [true, nil]