Path: utzoo!utgpu!water!watmath!clyde!rutgers!mit-eddie!bloom-beacon!gatech!purdue!umd5!eneevax!noise From: noise@eneevax.UUCP (Johnson Noise) Newsgroups: comp.lang.c Subject: Re: Power operator? Summary: Preprocessor Message-ID: <1165@eneevax.UUCP> Date: 8 Jan 88 20:58:08 GMT References: <47000029@uxe.cso.uiuc.edu> <3933@uw-june.UUCP> Reply-To: noise@eneevax.umd.edu.UUCP (Johnson Noise) Organization: Elec. Eng. Dept., U of Maryland, College Park, MD 20742 Lines: 18 In article <3933@uw-june.UUCP> pardo@uw-june.UUCP (David Keppel) writes: >[Why isn't there a power (e.g., a**2) operator in C?] > >The original intent of C was simplicity. Having ** is a fine idea, >but we have to draw a line somewhere and it was defaulted for us by K&R >a long time ago. If we have ** then perhaps we should also have ||= ? > I can concur with that. But, if you really MUST have a power operator, why not define one using the preprocessor? (I'm sure someone must have already suggested this, but so what). The subject of a power operator is a bit sundry, I think. I'm not sure, (correct me if I'm wrong), but I think there are even languages that do not have bit operators like &, |, !, ^, >>, << etc. I remember back in the days of FORTRAN when I actually had to write assembly routines to perform bit operations on integers. Lots of silly overhead just for one instruction. Anyway, C was designed to be used mostly for systems implementation, not necessarily for number crunching.