There is an interesting post at Math Stack Exchange in which something similar is asked, why is 0 0 = 1? And in which you can find multiple answers with explanations related to algebra, numerical calculation, set theory, discrete mathematics ...
And there is a short answer that may go unnoticed, but that explains why Oracle returns 1 when POWER(0,0)
is done. It's the kcrisman answer (my translation):
I am surprised that no one mentioned the IEEE standard for 0 0 . Many computer programs will return 0 0 = 1 for that. It is not a mathematical answer in itself, but it is important to point it out for the increase of the computational nature of modern mathematics, so that nobody gets confused with anything.
On the Wikipedia page linked by krisman, the following is specified on the 754 standard and its application in the programming languages (translation of the site in English, this part is not available in the Spanish version of the article):
IEEE Standard for floating point
The IEEE 754-2008 floating point standard is used in the design of most floating point libraries. Recommend some functions to calculate the powers:
-
pow
treats 0 0 as 1. This is the oldest defined version. If the power is an exact integer, the result is the same as with pown
, otherwise the result is the same as for powr
(except in some exceptional cases).
-
pown
treats 0 0 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 0 0 as NaN (Not-a-Number - undefined). The value is also NaN for cases such as' powr (-3.2) in which the base is less than zero. The value is defined by e power × log (base) .
Programming Languages
Most programming languages with a power function are implemented using the IEEE pow
function and therefore evaluate 0 0 as 1. The most recent C standards and C ++ describe this as the behavior as a rule. The Java standard imposes this behavior. The System.Math.Pow
method of the .NET framework also treats 0 0 as 1.
If you want more reference, this is the Spanish Wikipedia page on the IEEE 754-2008 standard , and the standard document (in English, in PDF).
Also, on this page of the documentation Oracle for Java , explains how the powers and special cases are calculated, the first special case being: " if the second argument is a positive or negative zero, the result is 1.0 " If Oracle applies the same calculation criteria for Java and for the database, then it is really that the power is not calculated, directly when seeing the second argument as 0, it returns 1 without stopping to check which is the first argument. p>