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

ark at alice.UUCP ark at alice.UUCP
Fri Jan 9 07:59:30 AEST 1987


Jeff Rodrigues asks why one should bother with fabs(x)
instead of making it a macro.  One answer is that if
fabs were a macro, then

	fabs(x*x-y*y)

would evaluate x*x-y*y twice on most C implementations.



More information about the Comp.lang.c mailing list