[DGD] Re: Math kfuns
Felix A. Croes
felix at dworkin.nl
Mon May 11 21:45:51 CEST 1998
Gregory D Lewis <glewis at maths.adelaide.edu.au> wrote:
> > My guess would be that as they would be implemented using whichever C
> > implementations are available at the current operating systems, which
> > may mean that their result (with respect to rounding and number of
> > decimals being used) cannot be guaranteed to be the same within DGD on
> > various platforms.
I do not intend to implement them using the host's versions of
those functions, at all, exactly for that reason.
> I suspect, without testing, that most compilers stick to the relevant
> IEEE/ANSI standard on this. I think it would be useful to at least have
> a kfun package which included say the trig functions and a pow function.
> While compilers may not produce _exactly_ the same result they will all be
> "close enough" for almost all intents and purposes.
"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.
> On a related note, why is fabs a kfun? Surely this is a one line trivial
> piece of LPC? This isn't a complaint, I'm just wondering why it has been
> chosen for kfun status.
fabs() is part of the same suite of functions, and included for
that reason. It has already been implemented because it is indeed
trivial. Another reason is that future code optimisation will be
easier if it exists as a kfun.
Dworkin
More information about the DGD
mailing list