[Freeciv-Dev] Re: MORT
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
--- Reinier Post <rp@xxxxxxxxxx> wrote:
> > Whether or not the code is absolutely horrible, I
> > suspect it pre-dates the widespread availability
> of
> > FPU hardware. I really doubt that the code saves
> any
> > time over
> >
> > const double MORTD=(double)(MORT-1)/MORT;
> > return (int)((double)b*exp(MORTD,d));
> >
> > on any machine with a FPU
>
> It's terrific, in the sense that it works great, but
> it's
> also practically impossible to understand.
>
> From the Changelog (June/July, 1998) it's clear that
> a lot of experimental
> tuning went into it before the release. And this
> includes tuning for
> performance - apparently some of these optimizations
> were only added
> when the code turned out to be too slow without
> them. An irreproducible
> mess of heuristic madness, in the best AI coding
> traditions.
I have done some testing, and determined, contrary to
my expectation:
1) The code is correct, even for large "d"
2) It is slightly quicker than the straightforward
method using doubles, even on a Pentium II
Gosh!
=====
Andrew McGuinness Luton, UK
andrew_mcguinness@xxxxxxxxxxx
__________________________________________________
Do You Yahoo!?
Yahoo! Photos -- now, 100 FREE prints!
http://photos.yahoo.com
|
|