Zero to the zero power: Difference between revisions

PascalABC.NET
(PascalABC.NET)
 
(23 intermediate revisions by 15 users not shown)
Line 184:
==={{header|BASIC256}}===
<syntaxhighlight lang="basic256">print "0 ^ 0 = "; 0 ^ 0</syntaxhighlight>
 
==={{header|Chipmunk Basic}}===
<syntaxhighlight lang="qbasic">10 print "0 ^ 0 = ";0^0</syntaxhighlight>
 
==={{header|MSX Basic}}===
<syntaxhighlight lang="qbasic">10 PRINT "0 ^ 0 = "; 0 ^ 0</syntaxhighlight>
 
==={{header|QBasic}}===
Line 189 ⟶ 195:
{{works with|QuickBasic|4.5}}
<syntaxhighlight lang="qbasic">PRINT "0 ^ 0 ="; 0 ^ 0</syntaxhighlight>
 
==={{header|Run BASIC}}===
{{works with|Just BASIC}}
{{works with|Liberty BASIC}}
<syntaxhighlight lang="lb">print "0 ^ 0 = "; 0 ^ 0</syntaxhighlight>
 
==={{header|True BASIC}}===
Line 195 ⟶ 206:
END</syntaxhighlight>
 
==={{header|XBasic}}===
{{works with|Windows XBasic}}
<syntaxhighlight lang="xbasic">PROGRAM "progname"
VERSION "0.0000"
 
IMPORT "xma" 'required for POWER
 
DECLARE FUNCTION Entry ()
 
FUNCTION Entry ()
PRINT "0 ^ 0 = "; 0 ** 0
PRINT "0 ^ 0 = "; POWER(0, 0)
END FUNCTION
END PROGRAM</syntaxhighlight>
 
==={{header|ZX Spectrum Basic}}===
<syntaxhighlight lang="zxbasic">PRINT 0↑0</syntaxhighlight>
 
{{out}}
<pre>
1
 
0 OK, 0:1
</pre>
 
=={{header|BBC BASIC}}==
Line 220 ⟶ 255:
{{out}}
<pre>1.000000</pre>
 
=={{header|Binary Lambda Calculus}}==
 
In lambda calculus, <code>\n. n n</code> is a function mapping a Church numeral n to the Church numeral n^n. The following BLC program computes this for n=0 by using its empty input as a Church numeral (since nil coincides with Church numeral 0), and outputting in unary (i.e as a string of 0^0 1s), as generated from https://github.com/tromp/AIT/blob/master/rosetta/exp00.lam :
 
<pre>0001010110100000010110111011010</pre>
 
Output:
 
<pre>1</pre>
 
=={{header|BQN}}==
Line 430 ⟶ 475:
BigInt: 1
Complex: 1+0i</pre>
 
=={{header|Dart}}==
<syntaxhighlight lang="dart">import 'dart:math';
 
void main() {
var resul = pow(0, 0);
print("0 ^ 0 = $resul");
}</syntaxhighlight>
{{out}}
<pre>0 ^ 0 = 1</pre>
 
=={{header|Dc}}==
Line 463 ⟶ 518:
 
=={{header|Elena}}==
ELENA 46.x
<syntaxhighlight lang="elena">import extensions;
public program()
{
console.printLine("0^0 is ",0.power:(0))
}</syntaxhighlight>
{{out}}
Line 487 ⟶ 542:
{{out}}
1
 
=={{header|EMal}}==
<syntaxhighlight lang="emal">
writeLine(0 ** 0) # an integer
writeLine(0.0 ** 0.0) # a real
</syntaxhighlight>
{{out}}
<pre>
1
1.0
</pre>
 
=={{header|ERRE}}==
Line 643 ⟶ 709:
complex: (1+0i)
</pre>
 
=={{header|Golfscript}}==
<syntaxhighlight lang="golfscript">0 0?</syntaxhighlight>
{{out}}
<pre>1</pre>
 
=={{header|Groovy}}==
Line 656 ⟶ 727:
 
=={{header|Haskell}}==
<syntaxhighlight lang="haskell">import Data.Complex ( Complex((:+)) )
 
main =:: doIO ()
main = mapM_ print $ 0 ^ 0[
print $ 0. 0 ^ 0,
print $ 0.0 ^^ 0,
print $ 0 **^^ 0,
print $ (0 :+ 0) ^** 0,
print $ (0 :+ 0) **^ (0 :+ 0)</syntaxhighlight>,
(0 :+ 0) ** (0 :+ 0)
]</syntaxhighlight>
{{out}}
<pre>1
1
1.0
1.0
1.0
1.0 :+ 0.0
NaN1.0 :+ NaN0.0</pre>
</pre>
 
=={{header|HolyC}}==
Line 708 ⟶ 779:
1</syntaxhighlight>
 
Note also that this is the multiplicative identity (which means that it's consistent with <code>1*0</code> representing <code>0^1</code> and with <code>1*0*0</code> representing <code>0^2</code> and with <code>1*0*0*0</code> representing <code>0^3</code> and with <code>1*2*2*2</code> representing <code>2^3</code> and so on. Also, this is the result of finding the product of an empty list:
 
<syntaxhighlight lang="J"> */''
1</syntaxhighlight>
 
(In <code><nowiki>*/''</nowiki></code> we're finding the product of a list which contains no characters. This is, of course, the same as the product of a list which contains no numbers when both lists contain neither. That said, characters are outside the domain of multiplication in J, so if the list had contained any characters the product would have been an error rather than a result.)
 
=={{header|Java}}==
Line 805 ⟶ 876:
 
=={{header|Kotlin}}==
<syntaxhighlight lang="scalakotlin">//import version 1kotlin.0math.6pow
 
fun main(args: Array<String>) {
println("0 ^ .0 = ${Math.pow(0.0, 0.0)}")
}</syntaxhighlight>
 
{{out}}
<pre>
0 ^ 0 = 1.0
</pre>
 
Line 823 ⟶ 894:
-> 1
</syntaxhighlight>
 
=={{header|LDPL}}==
<syntaxhighlight lang="ldpl">data:
x is number
 
procedure:
raise 0 to 0 in x
display x lf
</syntaxhighlight>
{{out}}
<pre>
1
</pre>
 
=={{header|Liberty BASIC}}==
Line 1,036 ⟶ 1,120:
 
=={{header|PARI/GP}}==
0 raised to the power of exact 0 is 01, but 0 cannot be raised to the power of an inexact 0:
<syntaxhighlight lang="parigp">0^0
0.^0
Line 1,059 ⟶ 1,143:
;output:
<pre>0.0 ^ 0 :1.00 0.0 ^ 0.0 :1.00</pre>
 
 
=={{header|PascalABC.NET}}==
<syntaxhighlight lang="delphi">
##
print(0 ** 0)
</syntaxhighlight>
{{out}}
<pre>1</pre>
 
=={{header|Perl}}==
Line 1,470 ⟶ 1,563:
see "z=" + z + nl # z=1
</syntaxhighlight>
 
=={{header|RPL}}==
0 0 ^
====Output for HP-48G and older models====
1: 1
====Output for HP-49 and newer models====
1: ?
 
=={{header|Ruby}}==
Line 1,627 ⟶ 1,727:
% expr 0.0**0.0
1.0</syntaxhighlight>
 
=={{header|TI SR-56}}==
<syntaxhighlight lang="text">0 Yx 0 =</syntaxhighlight>
 
{{out}}
<pre> 1 </pre>
 
=={{header|TI-83_BASIC}}==
Line 1,696 ⟶ 1,802:
 
=={{header|Wren}}==
<syntaxhighlight lang="ecmascriptwren">System.print(0.pow(0))</syntaxhighlight>
 
{{out}}
242

edits