[DGD] Re: Math kfuns

Felix A. Croes felix at dworkin.nl
Tue May 12 07:23:07 CEST 1998


Gregory D Lewis <glewis at maths.adelaide.edu.au> wrote:
> > "Most compilers" is not enough.  "Close enough" is not enough.
> > Whenever I implement them, I will make sure that they will
> > 1) be more accurate than can currently be expected on many platforms
> > 2) produce the same results on all platforms.
>
> Actually, close enough is almost invariably good enough for these operations.

Nope.  For example, many of the standard floating point functions on
i386 and later CPUs are accurate only within a certain restricted
range.


> With any compiler worth talking about your discrepancies will fall into two
> categories:
>
> 1) Different ways of handling overflow, underflow, etc.
>
> DGD should catch these and do something standard in each case, e.g. issue
> an error() for an overflow.
>
> 2) Differences in the last digit of the result.

This depends on the math library rather than the compiler.


> Irrelevant unless you are doing something inappropriate -- which is going to
> get you into trouble anyway.

A floating point number is computed and stored into a variable,
which is thereafter only consulted for further computations.
The mudlib and dump file are moved to a different platform with
different results for some floating point kfuns.  Now suddenly,
computations using the variable the value of which was
computed on a different platform no longer produce the expected
result.

As far as I am concerned, the existance of state dumps enforces
an identical implementation for these functions on all platforms.

Dworkin



More information about the DGD mailing list