How not to write a loop, revisited

Michael michael at stb.UUCP
Fri Jul 15 11:55:39 AEST 1988


In article <12784 at apple.Apple.COM> bgibbons at apple.apple.com.UUCP (Bill Gibbons) writes:
[ discussion of whats representable or not]
>but everyone with hardware floating-point will give you the
>right result for "trunc(x/y)".

ONLY if X and Y are the same sign.

>I agree that exponentiation is not safe, but raising a floating-point value to
>an integer (typed as integer) power is always done with repeated multiplies
>(in about log2(exponent) time), and since multiplies are accurate, so is this
>type of exponentiation.

Hmm, when I've written exponentiation routines I do it with logs and exp().
Are you sure all vendors do it as you say?
			Michael
: --- 
: Michael Gersten			 uunet.uu.net!denwa!stb!michael
:				sdcsvax!crash!gryphon!denwa!stb!michael
: What would have happened if we had lost World War 2. Well, the west coast
: would be owned by Japan, we would all be driving foreign cars, hmm...



More information about the Comp.lang.c mailing list