# A calculator's solution to irrational exponent

An irrational number cannot be represented by $\frac{p}{q}$ where $p$ and $q$ are integers.

And when we encounter exponents with decimal points, it is a possible way and a rather simple one to turn the exponent into the previous mentioned $\frac{p}{q}$ form and then figure the whole thing out using $a^{\frac{p}{q}}=\sqrt[q]{a^p}$.

So this way doesn't work for irrational exponents. How does a calculator do the job? Is it simply multiplication like $a^\pi=a^3\times a^{0.1}\times a^{0.04} \cdots$? Or with a more practical method?

-
Every number in a calculator's memory is rational because it has only finite memory. – Fixed Point May 1 '13 at 7:37
"We often turn the exponent..." No we don't! I've never heard of this. – TonyK May 1 '13 at 9:04
@TonyK OK to be precise I'll edit... – Greek Fellows May 1 '13 at 9:35

$$x^y = \exp(y \log(x))$$
I expect most calculators use $x^y = 2^{y\log_2x}$ instead. – TonyK May 1 '13 at 10:51
Floating-point numbers are stored in the form $2^em$, where $e$ is an integer and $m \in [1,2)$. So you only have to implement $2^x$ and $\log_2 x$ in the range $[1, 2)$. – TonyK May 1 '13 at 11:39
@TonyK: But I see no benefit (and, in fact, see detriment) to implementing $2^x$ and $\log_2 x$ rather than $e^x$ and $\log x$ in that range. – Hurkyl May 1 '13 at 12:02
Because you don't just have to implement it for $[1,2)$. You have to - for example - store a table of $\log x$ for all powers of 2. This takes up space, and introduces rounding errors. But the computation of transcendental functions is a huge and complicated subject, and this comment thread is not the place to discuss it in detail. – TonyK May 1 '13 at 12:17