POV-Ray : Newsgroups : povray.advanced-users : struggle with splines : Re: struggle with splines Server Time
6 Oct 2024 13:08:18 EDT (-0400)
  Re: struggle with splines  
From: Alain
Date: 4 Oct 2006 21:49:55
Message: <452464c3$1@news.povray.org>
Warp nous apporta ses lumieres en ce 04/10/2006 10:02:
> Chris B <c_b### [at] btconnectcomnospam> wrote:
>>>          #declare ctr = ctr + 0.01;
> 
>> If you specify "#while (ctr <= 1)", then I reckon it should end at P2, 
>> rather than one sphere before it gets to P2.
> 
>   Only in theory. In practice the last point may still be skipped.
> This is because 0.01 cannot be represented in an exact way in binary
> floating point format, and adding it repeatedly will cause the error
> to grow up so large that the end result will be significantly erroneous.
> 
>   (A number like 0.025 *can* be represented with exact accuracy with
> binary floating point but 0.01 can't. It might not be immediately obvious
> why, if you don't know how binary floating point works, but it's just
> like that. It's the same as 1/3 not having an exact representation in
> decimal.)
> 
You can circumvent the problem by multiplying everything by 100, and dividing by 
100 as you use the values to get the actual positions. It may slightly increase 
the parsing time, but you are now adding units and avoiding the rounding errors.

-- 
Alain
-------------------------------------------------
WARNING: the crumsumpten of alcohol may Mack you tink you kan tpye reel gode


Post a reply to this message

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