From: jbw Date: 2010-04-02T01:06:15+09:00 Subject: Re: Is there a method to set variable to NaN or Infinity? --001517447f08981f3404832f0a6b Content-Type: text/plain; charset=UTF-8 I read in the BigDecimal docs you can do n = BigDecimal.new('NaN'). But i'm unfamiliar with it On Thu, Apr 1, 2010 at 3:57 PM, Alex DeCaria wrote: > Is there a built-in method to set a floating point value to NaN or > Infinity? Or, is the only way to do this by > > a = 0.0/0.0 # set a to NaN > > b = 3.0/0.0 # set b to Infinity > > c = -3.0/0.0 # set c to -Infinity > > Also, how can I set value to -NaN? This is possible in other languages, > but I can't do it in Ruby. I've tried: > > a = 0.0/0.0 > > b = -a > > but b still comes out NaN. > > --Alex > -- > Posted via http://www.ruby-forum.com/. > > -- jbw --001517447f08981f3404832f0a6b--