Exponent and root calculator
Powers and roots — including the ones where your calculator quietly picked one of three defensible answers and did not mention it. Nothing you type here leaves your browser — it is worked out on your own device, so there is nothing to send and nothing to log.
The cube root of minus eight has three answers
Ask three systems what (−8)1/3 is and you get three different things. All of them were run on this machine rather than remembered:
- −2 — the real cube root, and what anybody typing the question means. −2 cubed is −8.
- 1 + 1.732i — Python's answer. The principal complex root, which is the right convention if you want roots to behave smoothly as the angle changes.
- NaN — JavaScript's
Math.pow. It will not guess which you meant.
None of them is wrong. They are answers to slightly different questions, and the thing worth knowing is that your calculator picked one without telling you.
00, and a claim that turns out to be false
It is widely said that systems disagree about
00. Checked on this machine: JavaScript gives
1, Python gives 1, and
math.pow(0,0) gives 1.0. They agree.
The real subtlety is different and more interesting. In discrete mathematics 00 = 1 by convention, and it has to be for the binomial theorem and power series to work. As a limit it is indeterminate: xy tends to different values depending on the path you take to the origin. Both statements are correct, in different contexts, and neither is a bug.
Why a fractional exponent is fussy at all
x1/n means the n-th root. When n is odd, a negative x has a real answer. When n is even, it does not — nothing real, squared, is negative.
Computers store 1/3 as 0.333... and cannot tell it apart from a
number that merely looks like a third, which is why
Math.pow refuses the whole class rather than trying.
This page takes the exponent as a fraction so it can tell.