Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!rutgers!mit-eddie!genrad!decvax!tektronix!uw-beaver!cornell!batcomputer!braner From: braner@batcomputer.UUCP Newsgroups: comp.lang.c Subject: Re: fabs(x) vs. (x) < 0 ? -(x) : (x) Message-ID: <2181@batcomputer.tn.cornell.edu> Date: Mon, 2-Feb-87 23:50:02 EST Article-I.D.: batcompu.2181 Posted: Mon Feb 2 23:50:02 1987 Date-Received: Thu, 5-Feb-87 01:45:15 EST References: <4943@mimsy.UUCP> <2550005@hpisod2.HP> <756@unc.unc.UUCP> Reply-To: braner@batcomputer.UUCP (braner) Organization: Theory Center, Cornell University, Ithaca NY Lines: 23 [] Somebody already said this a LONG time ago: Any macro definition of fabs() requires floating-point arithmetic (e.g. comparision with 0). That is A LOT slower than a dedicated fabs() function, written in assembly language of course, that simply clears the sign bit. In this context I'd like to complain again about the fact that, for historical reasons, the floating-point libraries provided with C compilers are generally far inferior to those provided with, say, FORTRAN compilers. Not very long ago most C compilers came without FP support at all, presumably assuming that C was used for system programming only. Even now most microcomputer implementations (on the 68000 at least) seem to have many bugs and are very slow. Compare, say, Megamax C with Absoft FORTRAN (both on the 68000). Since many people are now turning to C for scientific programming, I hope that compiler vendors are taking a second look at their ad-hoc second-thought FP slap-ons. THE COMPLETE FP LIBRARY MUST BE WRITTEN IN HAND-OPTIMIZED ASSEMBLER LANGUAGE!!! - Moshe Braner