Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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?

share|improve this question
    
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

1 Answer 1

up vote 1 down vote accepted

There is an identity

$$x^y = \exp(y \log(x))$$

share|improve this answer
    
I expect most calculators use $x^y = 2^{y\log_2x}$ instead. –  TonyK May 1 '13 at 10:51
    
@TonyK: I don't see that would help except in the rare case that the exponent turns out to be an integer. –  Hurkyl May 1 '13 at 11:27
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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