prev up next   top/contents search

comp.lang.c FAQ list · Question 14.7

Q: Why doesn't C have an exponentiation operator?

A: One reason is probably that few processors have a built-in exponentiation instruction. C has a pow function (declared in <math.h>) for performing exponentiation, although explicit multiplication is usually better for small positive integral exponents. [footnote] In other words, pow(x, 2.) is probably inferior to x * x. (If you're tempted to make a Square() macro, though, check question 10.1 first.)

References: ISO Sec.
H&S Sec. 17.6 p. 393

prev up next   contents search
about this FAQ list   about eskimo   search   feedback   copyright

Hosted by Eskimo North