On 31/07/07, Andy Lester <[EMAIL PROTECTED]> wrote:
>
> On Jul 31, 2007, at 1:32 PM, peter baylies wrote:
>
> > That may not be a bad idea, but I think there's a bug in that code --
> > take, for example, the case where x and y both equal approximately a
> > million (or more).
> >
> > Maybe you wanted this instead:
> >
> >      return (fabs(x - y) <= EPSILON) ? 1 : 0;
>
> The REAL question, I believe, is for comparisons to zero.  Last ptc
> and I talked about this, there were no places where the comparison in
> question isn't against 0.0.

I was really wondering what a good general solution was.  I remember
discussing this with you on #parrot and you mentioned a name for a
macro to handle the comparison, but I didn't understand what the
implementation would be from the name (I did ask, but I think you'd
gone offline).

Since we're only comparing against zero, would something like:

fabs(x) <= DBL_EPSILON ? 1: 0

do the job?  We're still running into the problem of "what if x is
float or double?".

I have a horrible feeling I missed your point when we were discussing
things on #parrot; could you explain how you would do it again?

Thanks!

Paul

Reply via email to