5

Why is there no exponentiation operation in hardware, even though many languages have builtin operators for it?

Is it because even hardware implementations would need to use the same algorithm as software (i.e. no hardware implementation could be significantly more efficient), or because it is rarely used, or another reason?

  • 1
    Some operations such as square root have been implemented in hardware vertex shaders (Source). – Neil Dec 24 '13 at 9:15
  • @Neil some architectures of old have evaluate polynomial in hardware (its the POLYx opcode). Dedicating that much silicon to such rarely used calls today isn't seen as widely practical. – user40980 Dec 24 '13 at 19:43
5

For integers, the only exponentiation operations that are normally present in hardware are the shifts, << and >> (in C parlance), which multiply by exponential powers of two. For anything else with integers, you run out of bits to represent things far too quickly for it to be useful; by the time you've sorted that problem out, you might as well not have special hardware support as you've also had to deal with memory management and other such expensive things.

I don't know floating-point hardware so well, but hardware exponentiation makes more sense there as you've got the numeric range to make it reasonable. (My google-fu indicates that someone seems to be selling the hardware layout to make this possible…)

1

Some machines (especially microcontrollers) include hardware to accelerate extended-precision (512+ bits) multiplies, and such hardware will inherently help with exponentiation as well (useful for things like RSA ciphers). Hardware to expedite precise exponentiation (other than by expediting multiplication) is rare because performance with or without such hardware is going to be dominated by the time required to do the constituent multiplications.

If one doesn't need precise results, one may raise floating-point numbers to any desired power by computing the log of the base, multiplying it by the exponent, and raising e to that power; many floating-point units include hardware to expedite all three of those steps.

  • It makes sense to put hardware on chip to do logarithms and the like. Some applications (not all, of course) will benefit very strongly from that sort of thing. – Donal Fellows Dec 24 '13 at 19:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.