[Freeciv-Dev] Re: (PR#12946) FACTOR in consider_settler_action
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12946 >
On Sun, May 01, 2005 at 04:10:42AM -0700, Benedict Adamson wrote:
> Those multipliers are used so we can use integer arithmetic, which in
> turn is done because integer arithmetic is faster than floating-point
> arithmetic (right?). But it introduces bugs like this (I have a vague
> recollection of similar bugs previously). But is this 'optimisation'
> really worthwhile? Is the performance gain large enough to justify the
> decreased reliability? I would not be surprised if the gain were small.
There's more than one reason to be wary of floating point, such as:
1e-8 != (1.0 + 1e-8) - 1.0
Also, Intel boxes have different floating-point (80-bit inside the FPU,
64-bit in memory) than the rest of the world (64-bit everywhere), which
means that client and server may disagree on certain things if they run
on different platforms.
But generally I agree that floating point should be used more often.
-- Benoît
|
|