Dear Filip and Raphael,
thank you both very much -- this is exactly what I needed! (I probably came
only up with the first version, because that is how it is usually done in
Lisp: loop for n from 0 to 1 by ...)
Best
Torsten
On Monday 25 June 2007 14:14:51 Raphael Collet wrote:
> 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
--
Torsten Anders
http://strasheela.sourceforge.net/
http://torsten-anders.de/
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users