fabs(x) vs. (x) < 0 ? -(x) : (x)

Chris Torek chris at mimsy.UUCP
Fri Jan 9 01:31:58 AEST 1987


In article <4477 at ut-ngp.UUCP> jjr at ut-ngp.UUCP (Jeff Rodriguez) writes:
>I.e., why isn't fabs() implemented as a macro?

Consider, e.g.,

	y = fabs(*fp++);

or

	y = fabs(a / b - c + d + e - f * g);

(where the latter may take much longer to compute twice than once
plus a subroutine call).
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690)
UUCP:	seismo!mimsy!chris	ARPA/CSNet:	chris at mimsy.umd.edu



More information about the Comp.lang.c mailing list