Dave Burt
4/18/2005 9:31:00 PM
Floats aren't that accurate - be careful when comparing them (see recent
thread "when 1.6 != 1.6? -- newbie"). Don't rely on the difference between
".." and "..." ranges when dealing with floats.
Pick a number (let's call it epsilon) that is smaller than the smallest
delta you care about, and use that.
Float::EPSILON, the smallest possible difference between any two floats, is
about 2e-16. You need to use a number bigger than that.
EPSILON = 1e-8
range = (0.0 + EPSILON .. 1.0 - EPSILON)
Cheers,
Dave
"Brian Buckley" <briankbuckley@gmail.com> wrote in message
news:a7b31d7105041813525c1e9b8c@mail.gmail.com...
Hello,
Is there a way to create a Range object which excludes the min value when
values in the Range are continuous? (If the values were discrete one could
just start with the succ value.)
For example, range = (0.0...1.0) is a range of Floats that includes the
value 0.0. How would one create such a Range but which excluded 0.0?
Thanks from a relatively new user of ruby,
Brian