Implementation of pow(3m) function

Allan Duncan aduncan at rhea.trl.oz.au
Fri Aug 10 08:16:32 AEST 1990


>From article <17301 at haddock.ima.isc.com>, by karl at haddock.ima.isc.com (Karl Heuer):
> *Some* Unix implementations do.  I have observed others in which roundoff
> error causes (int)pow(2.0, 3.0) to return 7; this is an excellent reason not
> to use pow() when you want integer exponentiation.  (I myself would prefer a
> new operator, `*^'.  I wrote an essay on this a couple of years ago.)

Ahh!  Shades of Fortran!  This is one of the reasons that ancient
language still keeps alive and well.  I find C's handling of mixed mode
arithmetic a little less than satisfactory, and the need to write
everything as functions obscures the mathematical form of an expression.
I might be forced to look at C++ if I am to throw over Fortran.

Allan Duncan	ACSnet	a.duncan at trl.oz
(03) 541 6708	ARPA	a.duncan%trl.oz.au at uunet.uu.net
		UUCP	{uunet,hplabs,ukc}!munnari!trl.oz.au!a.duncan
Telecom Research Labs, PO Box 249, Clayton, Victoria, 3168, Australia.



More information about the Comp.lang.c mailing list