POV-Ray : Newsgroups : povray.general : Long time, no see.. : Re: Long time, no see.. Server Time
19 Nov 2024 18:24:04 EST (-0500)
  Re: Long time, no see..  
From: Ben Chambers
Date: 24 Jan 2002 22:02:35
Message: <3c50cacb@news.povray.org>
"Mikael Carneholm" <mik### [at] idautbhbse>
wrote in message news:3C5### [at] idautbhbse...
> Thorsten Froehlich wrote:
>
> >
> > Floating-point numbers are not precise.  You should never assume they
are.
> >
>
> That's not a problem.

But the differences are so minute, it might be.  If you're comparing floats,
you should compare them within a small range, for instance,

if (fabs(a-b) < 0.001)

rather than

if (a == b)

Or something along those lines.
(Sorry, I've been using c++ lately, so the POV SDL equiv escapes my mind,
but it's not too different).

...Chambers


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.