Torsten,

Floats are not real numbers. Each time you sum two float, you increase the imprecision of the real numbers they are supposed to represent. In your case, the imprecision of the list elements is not the same for all elements.

Filip's last suggestion is the right one to me: use a better algorithm :-/

Filip Konvička wrote:

Yet another alternative is expressing each element of your sequence like

 Ei = ((Mx - Mn) * I / N) + Mn

fun {SampleInts N}
   for I in 0..(N-1)  collect:C do
      {C {IntToFloat I}/{IntToFloat N-1}}
   end
end


Cheers,
raph
_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to