# to the nth power

Richard A. O'Keefe ok at goanna.cs.rmit.oz.au
Mon Nov 5 15:12:46 AEST 1990


In article <prk.657559483 at pegasus>, prk at planet.bt.co.uk (Peter Knight) writes:
> The likely offered solutions in C, involving ln()/exp() or the pow() functions
> are not going to be a capable as Fortran's x**n.  These functions cannot cope
> with Fortran legal operations like (-1e6)**10.

This claim is false.  C's pow() function is precisely as capable as
Fortran's ** operator.  In particular,
	#include <math.h>
	...
	x = pow(-1.0e6, (double)10);
will set x to 1.0e60.  pow() checks for integral exponents.
-- 
The problem about real life is that moving one's knight to QB3
may always be replied to with a lob across the net.  --Alasdair Macintyre.



More information about the Comp.lang.c mailing list