17

I have checked the result of 0^0 in the calculator on different versions:

  • iOS 10.3 => 1
  • iOS 11.4 => Error
  • macOS 10.12.6 => 1
  • macOS 10.13.5 => Not a Number

What is the reason for the difference?

  • 22
    I'm gonna have to stick to High Sierra then, 'cos I love NaN bread ;-)) – Tetsujin Jul 6 '18 at 19:13
  • 5
  • also news.ycombinator.com/item?id=8502968 < (apple stopped publishing their version of the math library libm) – don bright Jul 8 '18 at 2:42
  • 3
    Are you asking so you can understand the mathematics, or are you asking to understand why Apple has changed its interpretation of 0^0 multiple times? If it's the former, there's an acceptable answer posted; if the latter, then that may not necessarily be answerable. – zr00 Jul 8 '18 at 23:54
  • In version 10.11.6 the result is 1 – Robert Kowal Jul 9 '18 at 13:50
20

While 0⁰ is generally undefined, some branches of mathematics do explicitly define it as 1 because, as you can see, this is the value to which the function y(x) = xˣ converges at n=0.

Less formally, note that 0.50.5=0.707…; 0.20.2=0.725…; 0.10.1=0.794… and 0.010.01=0.955…. As you approach 0, the result will be approaching 1, which makes it quite logical and handy to define 0^0 as 1 in some cases.

Thus, none of these 3 results are incorrect per se and instead they all reflect different conventions on the value of this undefined expression.

There is a good Wikipedia article explaining the issue. See also Zero to the zero power – is 0⁰=1?.

  • 4
    You mean at x=0, not n=0. – Ruslan Jul 8 '18 at 7:25
  • 2
    I have never before encountered that particular rationale for setting 0^0=1. After all, x^y has no limit as (x,y)→(0,0). However, if you write a general polynomial in the form ∑ c_n x^n, where n in the sum ranges from 0 to n (the degree of the polynomial), it becomes essential to have 0^0=1, or else the “constant” term is not so constant after all. See also here. – Harald Hanche-Olsen Jul 8 '18 at 8:47
  • @HaraldHanche-Olsen That's a very insightful point, please consider writing an answer, or feel free to edit mine. My intuition stemmed from the fact that most functions in the form e^{αx^β * ln^{ξx^γ + μ}} will converge to 1 (except for β=0 and maybe some other edge cases), and that class is frequently encountered in engineering applications, i.e. the kind of stuff that people will likely use the calculator app for, but I understand that's a bit far-fetched. – undercat supports Monica Jul 8 '18 at 13:08
  • 3
    Although this answer gives a good explanation of what 0^0 is/could be defined as, it doesn't explain why Apple has changed their interpretation a few times. – zr00 Jul 8 '18 at 23:53
  • 1
    @DawoodibnKareem My comment above, and more to the point, the referenced question on math.se, should explain why it may be useful to have 0^0 be 1. Of course, such a convention comes at a price: The expression x^y is discontinuous at (0,0). – Harald Hanche-Olsen Jul 9 '18 at 6:54
13

Most implementations of floating point arithmetic follow the IEEE 754-2008 standard, which specifies that pow(0,0) returns 1 (see §9.2.1).

But it also defines two other functions: pown(0,0) = 1 and powr(0,0) = NaN.

Wikipedia summarizes it as follows:

The IEEE 754-2008 floating-point standard is used in the design of most floating-point libraries. It recommends a number of operations for computing a power:[20]

pow treats 00 as 1. If the power is an exact integer the result is the same as for pown, otherwise the result is as for powr (except for some exceptional cases).

pown treats 00 as 1. The power must be an exact integer. The value is defined for negative bases; e.g., pown(−3,5) is −243. powr treats 00 as NaN (Not-a-Number – undefined). The value is also NaN for cases like powr(−3,2) where the base is less than zero. The value is defined by epower×log(base).

The pow variant is inspired by the pow function from C99, mainly for compatibility.[21] It is useful mostly for languages with a single power function. The pown and powr variants have been introduced due to conflicting usage of the power functions and the different points of view (as stated above).[22]

Of course this has no bearing on what the correct mathematical result is: as others have noted, there is more than one possible answer, and IEEE had to make an arbitrary decision.

5

Somebody at Apple figured out that 0^0 is an invalid operation and got it fixed.

5

Zero to the power of zero is a contradiction

  • 0 times any number is 0
  • any number to the 0 power is 1

It should generate an error. The only reason that you aren't seeing an error being generated is due to the fact that the version of Calculator in question didn't trap for that input error.

  • 9
    The (very rusty amateur) mathematician would want to argue that the limit of 0^x is 0 as x approaches 0 and the limit of x^x is 1 as x approaches 0 therefore you have a discontinuity which is the very definition of Indeterminate and warms my heard to see NaN on the one true OS – bmike Jul 6 '18 at 22:39
  • 1
    warms my heard - images of toasty warm sheep doing calculus problems with their Sheppard, @bmike :-D – Allan Jul 6 '18 at 23:54
  • 2
    @MrLister “defined by some authors and undefined by other authors” is precisely how math works. In almost all contexts, 0^0 = 1 is the right definition (e.g. it is the number of functions from the empty set to the empty set). The fact that x^y can’t be continuously extended into the origin is unfortunate and is the reason that some educators of analysis prefer to leave it undefined to prevent confusion, but even they have to take 0^0 = 1 once they get to power series. – Eike Schulte Jul 7 '18 at 14:02
  • 3
    @bmike There's no need to involve limits. Just because x^y would be discontinuous at (0, 0) doesn't mean you can't assign a value to 0^0 – Dennis Jul 7 '18 at 16:17
  • 3
    0^0 = 1 is absolutely not a contradiction. 0^0 is an empty product, and therefore 1. 0^0 is the cardinality of the set of functions from the empty set to the empty set, and there is exactly one such function. It's necessary for polynomials. The list goes on. – user76284 Jul 7 '18 at 17:13
4

There is some semicontroversy about 0⁰ that boils down to the function x^y having a discontinuity at (x,y)->(0,0). This is a semicontroversy since it is mathematical nonsense to forbid a function having a value at a discontinuity.

It is general practice to embed integers into the reals such that a function defined on the reals matches the same function defined on integers whenever the real function assumes integral values. So there is little point in distinguishing 0.0^0 from 0.0^0.0 .

Now x⁰ with the integer 0 as exponent is a product containing exactly zero factors of x. Since no factors of x are contained in its value, there is little point in assigning it a value depending on x, and its value as an empty product is pretty clearly 1, the neutral element for multiplication.

This makes also good sense since it does not arbitrarily restrict the binomial theorem to non-zero values. In a manner, this is an argument based on trying to complete the function x⁰ sensibly at x=0, making it defined and continuous everywhere.

If we try this with the function 0^x instead, the limit at x=0+ may be 0, but defining it as such still does not help curing the essential discontinuity since the function is undefined for negative x.

Now calculators tend to calculate x^y as exp(y*ln(x)). Of course that is bad news for x=0. So such values have to be explicitly programmed or you'll arrive at not-a-number. For explicit programming, you have to rely on the mathematical intuition of the programmer, and the typical programmer will be more guided by pseudomathematical intuition like "a function must be continuous where defined" than a mathematician would.

In addition, you can expect a flurry of comments from different users, and pure mathematicians will not revert to calculators for their vision of mathematical truth all that much, so you cannot expect their input to swamp that of others.

So the result is a democratic one more than a mathematical one, and democratic majorities tend to change.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .