POV-Ray : Newsgroups : povray.general : another bug report : Re: another bug report Server Time
13 Aug 2024 19:30:24 EDT (-0400)
  Re: another bug report  
From: PoD
Date: 6 Jul 1998 16:55:20
Message: <35A12B9E.1FA3@merlin.net.au>
Andrew Hedges wrote:
> 
> This looks like a "feature" of many programming languages that use
> floating point numbers, including POVRay's. It's caused by inaccuracies
> in the floating point calculations, such that tests like "T = 1.0" or "T
> < 1.0" produce weird results. Try using a test such "abs(T - 1.0) <
> 0.01" where 0.01 is a sufficiently small number for the accuracy you
> require, and things should work okay.
> 
> Andrew
> --
> Ob disclaimer: Of course, I might be wrong...
> 
> Guy Rauscher wrote:
> >
> > Hi!
> >
> > This bug exsited in the 3.0 version as well but I just found out about
> > it now. In certain cases (maybe its related to the use of numbers with a
> > decimal point) a while loop such as this: #while(I<1) loops one time too
> > many (as if it was #while(I<=1)). Just run the attached script.
> >
> > Guy
> >
> >   ------------------------------------------------------------------------
> 
> [most of example snipped]
> 
> > // Doesn't work!
> > #declare T = 0;
> > #declare Tinterval = 0.1;
> > #while(T < 1)
> >    #declare T = T + Tinterval;
> >    #debug concat("T",str(T,1,1)," ")
> > #end

Odd, POVRay is supposed to do that already.
According to the docs "A value of 0.0 is false and any non-zero value is
true. Note that extremely small values of about 1e-10 are considered
zero in case of round off errors."


Post a reply to this message

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