From: Siep Korteling Date: 2009-03-17T06:06:05+09:00 Subject: Re: upping numerical precision rpardee@gmail.com wrote: > Hey All, (...) > chi = -2.0 * Math.log(p) > > I'm finding that p is often going to 0.0 b/c the numbers returned by > calc_prob are sometimes outlandishly small (...) > That works, but makes me wonder if there's a smarter thing to do w/ > those rational and mathn libs to really get the effect I hoped for > just from including them in my script. > > Is there? > > Many thanks! > > -Roy Are you sure you required 'mathn' before defining your calc_prob method? big = 10**100 small = 1/big p small.zero? # true require 'mathn' small = 1/big p small.zero? # false p small.class # Rational p -2.0*Math.log(small) hth, Siep -- Posted via http://www.ruby-forum.com/.