[vox-tech] help with signals and C
Peter Jay Salzman
vox-tech@lists.lugod.org
Thu, 14 Mar 2002 09:32:44 -0800
begin Mark K. Kim <markslist@cbreak.org>
> On Thu, 14 Mar 2002, Peter Jay Salzman wrote:
>
> > example:
> >
> > temperature = 1.0
> >
> > trials Energy per site
> > 1,000 -2.000000
> > 10,000 -1.998448
> > 100,000 -1.997171
> > 1,000,000 -1.997530
> > 10,000,000 -1.997312 <-- very close
> > 100,000,000 -14.163610 <-- very not correct
>
> I have no idea what that means... At a glance, it looks like a rounding
> error to me...
here's how these numbers are generated
int trials = some big integer;
while (i < trials)
{
energy per site += some calculation;
}
energy per site /= trials*othernumbers
i hope this makes it clear that it can't be a rounding error. energy
per site accumulates some large value which gets divided by a common
factor at the end of the calculation.
if i really wanted to do 100,000,000 trials, i'd simply divide in the
loop. it would keep the number down but slow down the program and
introduce more rounding errors.
pete