|
|
Mael wrote:
>>It's roundoff error. I is probably .9999999 or so for the last iteration,
>>but it gets rounded for output.
>>
>
> isn t it strange to get a roundoff error for only 10 additions ? i thought
> pov was more precise :(
>
> M
>
You can get roundoff error with only one addition. It comes from the
fact that floating point numbers can not always be converted between
base2 and base10 without roundoff.
To see what happens, you have to modify your code to show all the
decimal places, like this:
#local i=0;
#while (i<1)
#debug concat(str(i,0,17),"\n")
#local i=i+0.1;
#end
Which (on my machine) produces:
0.00000000000000000
0.10000000000000001
0.20000000000000001
0.30000000000000004
0.40000000000000002
0.50000000000000000
0.59999999999999998
0.69999999999999996
0.79999999999999993
0.89999999999999991
0.99999999999999989
--
/*Francois Labreque*/#local a=x+y;#local b=x+a;#local c=a+b;#macro P(F//
/* flabreque */L)polygon{5,F,F+z,L+z,L,F pigment{rgb 9}}#end union
/* @ */{P(0,a)P(a,b)P(b,c)P(2*a,2*b)P(2*b,b+c)P(b+c,<2,3>)
/* videotron.ca */}camera{location<6,1.25,-6>look_at a orthographic}
Post a reply to this message
|
|