On Mar 16, 10:56=A0pm, Roy Pardee <rpar... / gmail.com> wrote:
>
> Thanks for the response! =A0I think the issue may be that I'm not doing
> any division--just multiplication. =A0Check it out:
>
> =A0 irb(main):001:0> require 'mathn'
> =A0 =3D> true
> =A0 irb(main):002:0> x =3D 0.5
> =A0 =3D> 0.5
> =A0 irb(main):003:0> 1000.times do
> =A0 irb(main):004:1* x *=3D x
> =A0 irb(main):005:1> end
> =A0 =3D> 1000
> =A0 irb(main):006:0> x
> =A0 =3D> 0.0
> =A0 irb(main):007:0> x.class
> =A0 =3D> Float
> =A0 irb(main):008:0>
>
> But the more I think about it, the more I think I'm fussing over
> nothing (ha ha!). =A0I think if my p var goes to zero, I should just set
> it =3D Float::MIN & break out of that loop. =A0My calc_prob method will
> only ever return values <=3D 1, so there's no sense in letting it
> continue to spin down the value of p (if you can tell what I'm trying
> to say).
>
> Thanks!
>
> -Roy

Roy,

It all depends on how much range of data you want. If you need more
granularity at the tiny end, you can always re-normalize... just
initialize p to be 1e6 or something, rather than 1. Then after the log
you can just subtract the constant exponent to get back to your
original range.

-t3ch.dude