POV-Ray : Newsgroups : povray.general : Blender Vs PovRay : Re: Blender Vs PovRay Server Time
31 Oct 2024 21:24:47 EDT (-0400)
  Re: Blender Vs PovRay  
From: Dan Connelly
Date: 25 Oct 2008 10:14:36
Message: <490329cc$1@news.povray.org>
Nicolas Alvarez wrote:
> The problem with doing #declare V=V+1/100; is that it might not reach 1.0000
> exactly at the end of the loop (because of floating point inaccuracies), so
> it might run one time too many.
> 

Right. If you MUST use floats, more robust is this sort of thing:

#local xmin = ....;
#local xmax = ....;
#local dx = .....;

#local x = xmin;
#while (x < xmax + dx / 2)
   #local x = x + dx;
#end


Post a reply to this message

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