Zero to the zero power: Difference between revisions

From Rosetta Code
Content added Content deleted
(Add CLU)
 
(44 intermediate revisions by 28 users not shown)
Line 2: Line 2:
[[Category:Simple]]
[[Category:Simple]]
{{omit from|6502 Assembly|There is no built in multiplication, let alone exponentiation. Thus the outcome is decided by the programmer not the language.}}
{{omit from|6502 Assembly|There is no built in multiplication, let alone exponentiation. Thus the outcome is decided by the programmer not the language.}}
{{omit from|8080 Assembly|See 6502 Assembly.}}
{{omit from|Computer/zero Assembly|See 6502 Assembly.}}
{{omit from|Z80 Assembly|See 6502 Assembly.}}
{{omit from|Z80 Assembly|See 6502 Assembly.}}
{{omit from|68000 Assembly|There is no built-in exponentiation so the programmer's implementation decides the outcome.}}
{{omit from|68000 Assembly|There is no built-in exponentiation so the programmer's implementation decides the outcome.}}
{{omit from|8086 Assembly}}
{{omit from|8086 Assembly|There is no built-in exponentiation so the programmer's implementation decides the outcome.}}
{{omit from|MIPS Assembly|There is no built-in exponentiation so the programmer's implementation decides the outcome.}}
{{omit from|ARM Assembly|See 8086 Assembly.}}
Some computer programming languages are not exactly consistent   (with other computer programming languages)  
Some computer programming languages are not exactly consistent   (with other computer programming languages)  
<br>when &nbsp; ''raising zero to the zeroth power'': &nbsp; &nbsp; <b><big>0<sup>0</sup></big></b>
<br>when &nbsp; ''raising zero to the zeroth power'': &nbsp; &nbsp; <b><big>0<sup>0</sup></big></b>
Line 25: Line 29:


;See also:
;See also:
* The Wiki entry: [[wp:Exponentiation#Zero_to_the_power_of_zero|Zero to the power of zero]].
* The Wiki entry: [[wp:Zero_to_the_power_of_zero#History|Zero to the power of zero]].
* The Wiki entry: [[wp:Exponentiation#History_of_differing_points_of_view|History of differing points of view]].
* The Wiki entry: [[wp:Zero_to_the_power_of_zero#History|Zero to the power of zero: History]].
* The MathWorld™ entry: [http://mathworld.wolfram.com/ExponentLaws.html exponent laws].
* The MathWorld™ entry: [http://mathworld.wolfram.com/ExponentLaws.html exponent laws].
** Also, in the above MathWorld™ entry, see formula ('''9'''): <math>x^0=1</math>.
** Also, in the above MathWorld™ entry, see formula ('''9'''): <math>x^0=1</math>.
Line 33: Line 37:


=={{header|11l}}==
=={{header|11l}}==
<lang 11l>print(0 ^ 0)</lang>
<syntaxhighlight lang="11l">print(0 ^ 0)</syntaxhighlight>


{{out}}
{{out}}
Line 41: Line 45:


=={{header|8th}}==
=={{header|8th}}==
<lang forth>
<syntaxhighlight lang="forth">
0 0 ^ .
0 0 ^ .
</syntaxhighlight>
</lang>
{{out}}
{{out}}
1
1
Line 49: Line 53:


{{omit from|ARM Assembly}}
{{omit from|ARM Assembly}}

=={{header|Action!}}==
{{libheader|Action! Tool Kit}}
<syntaxhighlight lang="action!">INCLUDE "D2:REAL.ACT" ;from the Action! Tool Kit

PROC Main()
REAL z,res

Put(125) PutE() ;clear the screen

IntToReal(0,z)
Power(z,z,res)

PrintR(z) Print("^")
PrintR(z) Print("=")
PrintRE(res)
RETURN</syntaxhighlight>
{{out}}
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Zero_to_the_zero_power.png Screenshot from Atari 8-bit computer]
<pre>
0^0=.9999999998
</pre>


=={{header|Ada}}==
=={{header|Ada}}==
<lang Ada>with Ada.Text_IO, Ada.Integer_Text_IO, Ada.Long_Integer_Text_IO,
<syntaxhighlight lang="ada">with Ada.Text_IO, Ada.Integer_Text_IO, Ada.Long_Integer_Text_IO,
Ada.Long_Long_Integer_Text_IO, Ada.Float_Text_IO, Ada.Long_Float_Text_IO,
Ada.Long_Long_Integer_Text_IO, Ada.Float_Text_IO, Ada.Long_Float_Text_IO,
Ada.Long_Long_Float_Text_IO;
Ada.Long_Long_Float_Text_IO;
Line 82: Line 108:
Put (LLF ** Zero); New_Line;
Put (LLF ** Zero); New_Line;
end Test5;
end Test5;
</syntaxhighlight>
</lang>
{{out}}
{{out}}
<pre>Integer 0^0 = 1
<pre>Integer 0^0 = 1
Line 94: Line 120:
=={{header|ALGOL 68}}==
=={{header|ALGOL 68}}==
{{works with|ALGOL 68G|Any - tested with release 2.6.win32}}
{{works with|ALGOL 68G|Any - tested with release 2.6.win32}}
<lang algol68>print( ( 0 ^ 0, newline ) )
<syntaxhighlight lang="algol68">print( ( 0 ^ 0, newline ) )
</syntaxhighlight>
</lang>
{{out}}
{{out}}
<pre>
<pre>
Line 102: Line 128:


=={{header|APL}}==
=={{header|APL}}==
<lang apl> 0*0
<syntaxhighlight lang="apl"> 0*0
1</lang>
1</syntaxhighlight>


=={{header|AppleScript}}==
=={{header|AppleScript}}==
<lang applescript> return 0 ^ 0</lang>
<syntaxhighlight lang="applescript"> return 0 ^ 0</syntaxhighlight>


{{output}}
{{output}}
<lang applescript>1.0</lang>
<syntaxhighlight lang="applescript">1.0</syntaxhighlight>


=={{header|Applesoft BASIC}}==
=={{header|Applesoft BASIC}}==
Line 119: Line 145:
=={{header|Arturo}}==
=={{header|Arturo}}==


<lang rebol>print 0 ^ 0
<syntaxhighlight lang="rebol">print 0 ^ 0
print 0.0 ^ 0</lang>
print 0.0 ^ 0</syntaxhighlight>


{{out}}
{{out}}
Line 126: Line 152:
<pre>1
<pre>1
1.0</pre>
1.0</pre>

=={{header|Asymptote}}==
<syntaxhighlight lang="asymptote">write("0 ^ 0 = ", 0 ** 0);</syntaxhighlight>


=={{header|AutoHotkey}}==
=={{header|AutoHotkey}}==
<lang AutoHotkey>MsgBox % 0 ** 0</lang>
<syntaxhighlight lang="autohotkey">MsgBox % 0 ** 0</syntaxhighlight>
{{out}}
{{out}}
<pre>1</pre>
<pre>1</pre>


=={{header|AWK}}==
=={{header|AWK}}==
<syntaxhighlight lang="awk">
<lang AWK>
# syntax: GAWK -f ZERO_TO_THE_ZERO_POWER.AWK
# syntax: GAWK -f ZERO_TO_THE_ZERO_POWER.AWK
BEGIN {
BEGIN {
Line 139: Line 168:
exit(0)
exit(0)
}
}
</syntaxhighlight>
</lang>
{{out}}
{{out}}
<pre>
<pre>
Line 146: Line 175:


=={{header|BaCon}}==
=={{header|BaCon}}==
<lang freebasic>PRINT POW(0, 0)</lang>
<syntaxhighlight lang="freebasic">PRINT POW(0, 0)</syntaxhighlight>


{{out}}
{{out}}
<pre>prompt$ ./zerotothezero
<pre>prompt$ ./zerotothezero
1</pre>
1</pre>

=={{header|BASIC}}==
==={{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}}===
{{works with|QBasic|1.1}}
{{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}}===
{{works with|QBasic}}
<syntaxhighlight lang="qbasic">PRINT "0 ^ 0 ="; 0 ^ 0
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}}==
=={{header|BBC BASIC}}==
<lang bbcbasic> PRINT 0^0</lang>
<syntaxhighlight lang="bbcbasic"> PRINT 0^0</syntaxhighlight>


{{out}}
{{out}}
Line 161: Line 240:


=={{header|Bc}}==
=={{header|Bc}}==
<syntaxhighlight lang="bc">
<lang Bc>
0 ^ 0
0 ^ 0
</syntaxhighlight>
</lang>
{{out}}
{{out}}
1
1
Line 172: Line 251:
Note that the result is potentially dependent on the underlying language of the interpreter, but all those tested so far have returned 1. Interpreters that don't support '''Befunge-98''', or don't support this fingerprint, should just terminate (possibly with a warning).
Note that the result is potentially dependent on the underlying language of the interpreter, but all those tested so far have returned 1. Interpreters that don't support '''Befunge-98''', or don't support this fingerprint, should just terminate (possibly with a warning).


<lang befunge>"PDPF"4#@(0F0FYP)@</lang>
<syntaxhighlight lang="befunge">"PDPF"4#@(0F0FYP)@</syntaxhighlight>


{{out}}
{{out}}
<pre>1.000000</pre>
<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}}==
BQN doesn't specify the details of arithmetic functions; existing implementations use IEEE doubles and the <code>pow</code> function, giving a result of 1.
<syntaxhighlight lang="bqn">0⋆0</syntaxhighlight>
{{out}}
<pre>1</pre>


=={{header|Bracmat}}==
=={{header|Bracmat}}==
<lang bracmat>0^0</lang>
<syntaxhighlight lang="bracmat">0^0</syntaxhighlight>
{{out}}
{{out}}
<pre>1</pre>
<pre>1</pre>


=={{header|Burlesque}}==
=={{header|Burlesque}}==
<lang blsq>
<syntaxhighlight lang="blsq">
blsq ) 0.0 0.0?^
blsq ) 0.0 0.0?^
1.0
1.0
blsq ) 0 0?^
blsq ) 0 0?^
1
1
</syntaxhighlight>
</lang>


=={{header|C}}==
=={{header|C}}==
Line 194: Line 289:
This example uses the standard <code>pow</code> function in the math library.
This example uses the standard <code>pow</code> function in the math library.
0^0 is given as 1.
0^0 is given as 1.
<lang c>#include <stdio.h>
<syntaxhighlight lang="c">#include <stdio.h>
#include <math.h>
#include <math.h>
#include <complex.h>
#include <complex.h>
Line 204: Line 299:
printf("0+0i ^ 0+0i = %f+%fi\n", creal(c), cimag(c));
printf("0+0i ^ 0+0i = %f+%fi\n", creal(c), cimag(c));
return 0;
return 0;
}</lang>
}</syntaxhighlight>


{{out}}
{{out}}
Line 213: Line 308:


=={{header|C sharp|C#}}==
=={{header|C sharp|C#}}==
<lang csharp>using System;
<syntaxhighlight lang="csharp">using System;


namespace ZeroToTheZeroeth
namespace ZeroToTheZeroeth
Line 225: Line 320:
}
}
}
}
}</lang>
}</syntaxhighlight>


{{out}}
{{out}}
Line 233: Line 328:


=={{header|C++}}==
=={{header|C++}}==
<lang cpp>#include <iostream>
<syntaxhighlight lang="cpp">#include <iostream>
#include <cmath>
#include <cmath>
#include <complex>
#include <complex>
Line 243: Line 338:
std::pow(std::complex<double>(0),std::complex<double>(0)) << std::endl;
std::pow(std::complex<double>(0),std::complex<double>(0)) << std::endl;
return 0;
return 0;
}</lang>
}</syntaxhighlight>


{{out}}
{{out}}
Line 252: Line 347:


=={{header|Caché ObjectScript}}==
=={{header|Caché ObjectScript}}==
<lang Caché ObjectScript>ZEROPOW
<syntaxhighlight lang="caché objectscript">ZEROPOW
// default behavior is incorrect:
// default behavior is incorrect:
set (x,y) = 0
set (x,y) = 0
Line 261: Line 356:
w !,"0 to the 0th power (right): "_(x**y)
w !,"0 to the 0th power (right): "_(x**y)
quit</lang>
quit</syntaxhighlight>


{{out}}<pre>SAMPLES>do ^ZEROPOW
{{out}}<pre>SAMPLES>do ^ZEROPOW
Line 283: Line 378:
1 in my case could just be an implementation detail.
1 in my case could just be an implementation detail.


<lang clu>start_up = proc ()
<syntaxhighlight lang="clu">start_up = proc ()
zz_int: int := 0 ** 0
zz_int: int := 0 ** 0
zz_real: real := 0.0 ** 0.0
zz_real: real := 0.0 ** 0.0
Line 290: Line 385:
stream$putl(po, "integer 0**0: " || int$unparse(zz_int))
stream$putl(po, "integer 0**0: " || int$unparse(zz_int))
stream$putl(po, "real 0**0: " || f_form(zz_real, 1, 1))
stream$putl(po, "real 0**0: " || f_form(zz_real, 1, 1))
end start_up</lang>
end start_up</syntaxhighlight>
{{out}}
{{out}}
<pre>integer 0**0: 1
<pre>integer 0**0: 1
Line 296: Line 391:


=={{header|COBOL}}==
=={{header|COBOL}}==
<lang cobol>identification division.
<syntaxhighlight lang="cobol">identification division.
program-id. zero-power-zero-program.
program-id. zero-power-zero-program.
data division.
data division.
Line 304: Line 399:
compute n = 0**0.
compute n = 0**0.
display n upon console.
display n upon console.
stop run.</lang>
stop run.</syntaxhighlight>
{{out}}
{{out}}
<pre>1</pre>
<pre>1</pre>
Line 310: Line 405:
=={{header|ColdFusion}}==
=={{header|ColdFusion}}==
=== Classic tag based CFML ===
=== Classic tag based CFML ===
<lang cfm>
<syntaxhighlight lang="cfm">
<cfset zeroPowerTag = 0^0>
<cfset zeroPowerTag = 0^0>
<cfoutput>"#zeroPowerTag#"</cfoutput>
<cfoutput>"#zeroPowerTag#"</cfoutput>
</syntaxhighlight>
</lang>
{{Output}}
{{Output}}
<pre>
<pre>
Line 320: Line 415:


=== Script Based CFML ===
=== Script Based CFML ===
<lang cfm><cfscript>
<syntaxhighlight lang="cfm"><cfscript>
zeroPower = 0^0;
zeroPower = 0^0;
writeOutput( zeroPower );
writeOutput( zeroPower );
</cfscript></lang>
</cfscript></syntaxhighlight>
{{Output}}
{{Output}}
<pre>
<pre>
Line 347: Line 442:


=={{header|Crystal}}==
=={{header|Crystal}}==
<lang crystal>puts "Int32: #{0_i32**0_i32}"
<syntaxhighlight lang="crystal">puts "Int32: #{0_i32**0_i32}"
puts "Negative Int32: #{-0_i32**-0_i32}"
puts "Negative Int32: #{-0_i32**-0_i32}"
puts "Float32: #{0_f32**0_f32}"
puts "Float32: #{0_f32**0_f32}"
puts "Negative Float32: #{-0_f32**-0_f32}"</lang>
puts "Negative Float32: #{-0_f32**-0_f32}"</syntaxhighlight>


{{Output}}
{{Output}}
Line 359: Line 454:


=={{header|D}}==
=={{header|D}}==
<lang d>void main() {
<syntaxhighlight lang="d">void main() {
import std.stdio, std.math, std.bigint, std.complex;
import std.stdio, std.math, std.bigint, std.complex;


Line 370: Line 465:
writeln("BigInt: ", 0.BigInt ^^ 0);
writeln("BigInt: ", 0.BigInt ^^ 0);
writeln("Complex: ", complex(0.0, 0.0) ^^ 0);
writeln("Complex: ", complex(0.0, 0.0) ^^ 0);
}</lang>
}</syntaxhighlight>
{{out}}
{{out}}
<pre>Int: 1
<pre>Int: 1
Line 380: Line 475:
BigInt: 1
BigInt: 1
Complex: 1+0i</pre>
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}}==
=={{header|Dc}}==
<lang dc>0 0^p
<syntaxhighlight lang="dc">0 0^p
</syntaxhighlight>
</lang>
{{Output}}
{{Output}}
<pre>
<pre>
Line 394: Line 499:
=={{header|EasyLang}}==
=={{header|EasyLang}}==


<lang>print pow 0 0</lang>
<syntaxhighlight lang="text">print pow 0 0</syntaxhighlight>


=={{header|EchoLisp}}==
=={{header|EchoLisp}}==
<lang scheme>
<syntaxhighlight lang="scheme">
;; trying the 16 combinations
;; trying the 16 combinations
;; all return the integer 1
;; all return the integer 1
Line 405: Line 510:
(for* ((z1 zeroes) (z2 zeroes)) (write (expt z1 z2)))
(for* ((z1 zeroes) (z2 zeroes)) (write (expt z1 z2)))
→ 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
→ 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
</syntaxhighlight>
</lang>


=={{header|Eiffel}}==
=={{header|Eiffel}}==
<lang Eiffel>print (0^0)</lang>
<syntaxhighlight lang="eiffel">print (0^0)</syntaxhighlight>
{{out}}
{{out}}
<pre>1</pre>
<pre>1</pre>


=={{header|Elena}}==
=={{header|Elena}}==
ELENA 4.x
ELENA 6.x
<lang elena>import extensions;
<syntaxhighlight lang="elena">import extensions;
public program()
public program()
{
{
console.printLine("0^0 is ",0.power:0)
console.printLine("0^0 is ",0.power(0))
}</lang>
}</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>
Line 427: Line 532:
=={{header|Elixir}}==
=={{header|Elixir}}==
Elixir uses Erlang's <code>:math</code> for power operations and can handle zero to the zero power.
Elixir uses Erlang's <code>:math</code> for power operations and can handle zero to the zero power.
<syntaxhighlight lang="elixir">
<lang Elixir>
:math.pow(0,0)
:math.pow(0,0)
</syntaxhighlight>
</lang>


{{out}}
{{out}}
1.0
1.0
=={{header|Emacs Lisp}}==
=={{header|Emacs Lisp}}==
<lang Lisp>(expt 0 0)</lang>
<syntaxhighlight lang="lisp">(expt 0 0)</syntaxhighlight>
{{out}}
{{out}}
1

=={{header|EMal}}==
<syntaxhighlight lang="emal">
writeLine(0 ** 0) # an integer
writeLine(0.0 ** 0.0) # a real
</syntaxhighlight>
{{out}}
<pre>
1
1
1.0
</pre>


=={{header|ERRE}}==
=={{header|ERRE}}==
<syntaxhighlight lang="erre">
<lang ERRE>
.....
.....
PRINT(0^0)
PRINT(0^0)
.....
.....
</syntaxhighlight>
</lang>
{{out}}
{{out}}
<pre> 1
<pre> 1
Line 455: Line 571:


=={{header|Factor}}==
=={{header|Factor}}==
<lang factor>USING: math.functions.private ; ! ^complex
<syntaxhighlight lang="factor">USING: math.functions.private ; ! ^complex
0 0 ^
0 0 ^
C{ 0 0 } C{ 0 0 } ^complex</lang>
C{ 0 0 } C{ 0 0 } ^complex</syntaxhighlight>
{{out}}
{{out}}
<pre>--- Data stack:
<pre>--- Data stack:
Line 465: Line 581:
=={{header|Falcon}}==
=={{header|Falcon}}==
'''VBA/Python programmer's approach not sure if it's the most falconic way'''
'''VBA/Python programmer's approach not sure if it's the most falconic way'''
<lang falcon>
<syntaxhighlight lang="falcon">
/* created by Aykayayciti Earl Lamont Montgomery
/* created by Aykayayciti Earl Lamont Montgomery
April 9th, 2018 */
April 9th, 2018 */
Line 474: Line 590:
> "z=", z
> "z=", z


</syntaxhighlight>
</lang>
{{out}}
{{out}}
<pre>
<pre>
Line 482: Line 598:


=={{header|Fermat}}==
=={{header|Fermat}}==
<lang fermat>0^0</lang>
<syntaxhighlight lang="fermat">0^0</syntaxhighlight>
{{out}}<pre>1</pre>
{{out}}<pre>1</pre>


=={{header|Forth}}==
=={{header|Forth}}==
<lang forth>0e 0e f** f.</lang>
<syntaxhighlight lang="forth">0e 0e f** f.</syntaxhighlight>


{{out}}
{{out}}
Line 493: Line 609:
Of course in an embedded program we would be tempted to "pre-calculate" the answer :-)
Of course in an embedded program we would be tempted to "pre-calculate" the answer :-)


<lang Forth>: ^0 DROP 1 ;</lang>
<syntaxhighlight lang="forth">: ^0 DROP 1 ;</syntaxhighlight>


{{Output}}
{{Output}}
Line 502: Line 618:
=={{header|Fortran}}==
=={{header|Fortran}}==


<syntaxhighlight lang="fortran">
<lang Fortran>
program zero
program zero
double precision :: i, j
double precision :: i, j
Line 514: Line 630:
write(*,*) 'When complex numbers are used, we have (0.0+0.0i)^(0.0+0.0i) = ', z1**z2
write(*,*) 'When complex numbers are used, we have (0.0+0.0i)^(0.0+0.0i) = ', z1**z2
end program
end program
</syntaxhighlight>
</lang>
{{out}}
{{out}}
<pre>
<pre>
Line 523: Line 639:


=={{header|FreeBASIC}}==
=={{header|FreeBASIC}}==
<lang freebasic>' FB 1.05.0 Win64
<syntaxhighlight lang="freebasic">' FB 1.05.0 Win64


Print "0 ^ 0 ="; 0 ^ 0
Print "0 ^ 0 ="; 0 ^ 0
Sleep</lang>
Sleep</syntaxhighlight>


{{out}}
{{out}}
Line 534: Line 650:


=={{header|Frink}}==
=={{header|Frink}}==
<lang frink>println[0^0]</lang>
<syntaxhighlight lang="frink">println[0^0]</syntaxhighlight>


{{out}}
{{out}}
Line 543: Line 659:


=={{header|FutureBasic}}==
=={{header|FutureBasic}}==
<lang futurebasic>
<syntaxhighlight lang="futurebasic">window 1
include "ConsoleWindow"


print 0^0
print 0^0

</lang>
HandleEvents</syntaxhighlight>
Output:
Output:
<pre>
<pre>
Line 555: Line 671:
=={{header|Gambas}}==
=={{header|Gambas}}==
'''[https://gambas-playground.proko.eu/?gist=7d505dbe89227e9b4423f92ef12d6829 Click this link to run this code]'''
'''[https://gambas-playground.proko.eu/?gist=7d505dbe89227e9b4423f92ef12d6829 Click this link to run this code]'''
<lang gambas>Public Sub Main()
<syntaxhighlight lang="gambas">Public Sub Main()


Print 0 ^ 0
Print 0 ^ 0


End</lang>
End</syntaxhighlight>
Output:
Output:
<pre>
<pre>
1
1
</pre>
</pre>

=={{header|GAP}}==
<syntaxhighlight lang="gap">0^0;</syntaxhighlight>
{{out}}<pre>1</pre>


=={{header|Go}}==
=={{header|Go}}==
Go does not have an exponentiation operator but has functions in the standard library for three types, float64, complex128, and big.Int.
Go does not have an exponentiation operator but has functions in the standard library for three types, float64, complex128, and big.Int.
As of Go 1.3, all are documented to return 1.
As of Go 1.3, all are documented to return 1.
<lang go>package main
<syntaxhighlight lang="go">package main


import (
import (
Line 582: Line 702:
fmt.Println("big integer:", b.Exp(&b, &b, nil))
fmt.Println("big integer:", b.Exp(&b, &b, nil))
fmt.Println("complex: ", cmplx.Pow(0, 0))
fmt.Println("complex: ", cmplx.Pow(0, 0))
}</lang>
}</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>
Line 589: Line 709:
complex: (1+0i)
complex: (1+0i)
</pre>
</pre>

=={{header|Golfscript}}==
<syntaxhighlight lang="golfscript">0 0?</syntaxhighlight>
{{out}}
<pre>1</pre>


=={{header|Groovy}}==
=={{header|Groovy}}==
{{trans|Java}}
{{trans|Java}}
Test:
Test:
<lang groovy>println 0**0</lang>
<syntaxhighlight lang="groovy">println 0**0</syntaxhighlight>
{{out}}
{{out}}
<pre>1</pre>
<pre>1</pre>


=={{header|GW-BASIC}}==
=={{header|GW-BASIC}}==
<lang gwbasic>PRINT 0^0</lang>
<syntaxhighlight lang="gwbasic">PRINT 0^0</syntaxhighlight>
{{out}}<pre>1</pre>
{{out}}<pre>1</pre>


=={{header|Haskell}}==
=={{header|Haskell}}==
<lang haskell>import Data.Complex
<syntaxhighlight lang="haskell">import Data.Complex ( Complex((:+)) )


main = do
main :: IO ()
print $ 0 ^ 0
main = mapM_ print [
print $ 0.0 ^ 0
0 ^ 0,
print $ 0 ^^ 0
0.0 ^ 0,
print $ 0 ** 0
0 ^^ 0,
print $ (0 :+ 0) ^ 0
0 ** 0,
print $ (0 :+ 0) ** (0 :+ 0)</lang>
(0 :+ 0) ^ 0,
(0 :+ 0) ** (0 :+ 0)
]</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>1
1
1.0
1.0
1.0
1.0
1.0
1.0
1.0 :+ 0.0
1.0 :+ 0.0
NaN :+ NaN
1.0 :+ 0.0</pre>
</pre>


=={{header|HolyC}}==
=={{header|HolyC}}==
<lang holyc>F64 a = 0 ` 0;
<syntaxhighlight lang="holyc">F64 a = 0 ` 0;
Print("0 ` 0 = %5.3f\n", a);</lang>
Print("0 ` 0 = %5.3f\n", a);</syntaxhighlight>


{{out}}
{{out}}
Line 633: Line 758:


"Works" in both languages:
"Works" in both languages:
<lang unicon>procedure main()
<syntaxhighlight lang="unicon">procedure main()
write(0^0)
write(0^0)
end</lang>
end</syntaxhighlight>


{{out}}
{{out}}
Line 651: Line 776:


=={{header|J}}==
=={{header|J}}==
<lang j> 0 ^ 0
<syntaxhighlight lang="j"> 0 ^ 0
1</lang>
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}}==
=={{header|Java}}==
<lang java>System.out.println(Math.pow(0, 0));</lang>
<syntaxhighlight lang="java">System.out.println(Math.pow(0, 0));</syntaxhighlight>
{{out}}
{{out}}
<pre>1.0</pre>
<pre>1.0</pre>
Line 663: Line 795:
{{Works with|Node.js}}
{{Works with|Node.js}}
In interactive mode:
In interactive mode:
<lang javascript>> Math.pow(0, 0);
<syntaxhighlight lang="javascript">> Math.pow(0, 0);
1</lang>
1</syntaxhighlight>
===exponentiation operator (**)===
===exponentiation operator (**)===
<lang javascript>> 0**0
<syntaxhighlight lang="javascript">> 0**0
1</lang>
1</syntaxhighlight>


=={{header|jq}}==
=={{header|jq}}==
{{works with|jq|1.5}}
jq version 1.4 does not have a builtin "power" function. If it were to be defined
'''Also works with gojq and fq'''
using the exp and log builtins as 'log * y | exp', then 0 | power(0) would yield null, and therefore
<pre>
a definition that makes a special case of 0^0 should be considered, e.g.
$ jq -n 'pow(0;0)'
along the following lines:
1
<lang jq>def power(y): y as $y | if $y == 0 then 1 elif . == 0 then 0 else log * $y | exp end;</lang>
</pre>

It is also worth noting that in jq, gojq, and fq, `pow(0; infinite)` yields 0.
This definition will however be unsatisfactory for many purposes
because it does not maintain precision for integer values of the input (.) and y.


=={{header|Jsish}}==
=={{header|Jsish}}==
<lang javascript>puts(Math.pow(0,0));</lang>
<syntaxhighlight lang="javascript">puts(Math.pow(0,0));</syntaxhighlight>
{{out}}
{{out}}
<pre>1</pre>
<pre>1</pre>
Line 686: Line 817:
=={{header|Julia}}==
=={{header|Julia}}==
Try all combinations of complex, float, rational, integer and boolean.
Try all combinations of complex, float, rational, integer and boolean.
<lang Julia>using Printf
<syntaxhighlight lang="julia">using Printf


const types = (Complex, Float64, Rational, Int, Bool)
const types = (Complex, Float64, Rational, Int, Bool)
Line 694: Line 825:
r = zb ^ ze
r = zb ^ ze
@printf("%10s ^ %-10s = %7s ^ %-7s = %-12s (%s)\n", Tb, Te, zb, ze, r, typeof(r))
@printf("%10s ^ %-10s = %7s ^ %-7s = %-12s (%s)\n", Tb, Te, zb, ze, r, typeof(r))
end</lang>
end</syntaxhighlight>


{{out}}
{{out}}
Line 724: Line 855:


=={{header|K}}==
=={{header|K}}==
<syntaxhighlight lang="k">
<lang K>
0^0
0^0
1.0
1.0
</syntaxhighlight>
</lang>


=={{header|Klingphix}}==
=={{header|Klingphix}}==
<lang Klingphix>:mypower
<syntaxhighlight lang="klingphix">:mypower
dup not (
dup not (
[ drop sign dup 0 equal [ drop 1 ] if ]
[ drop sign dup 0 equal [ drop 1 ] if ]
Line 739: Line 870:
0 0 mypower print nl
0 0 mypower print nl


"End " input</lang>
"End " input</syntaxhighlight>
{{out}}
{{out}}
<pre>1
<pre>1
Line 745: Line 876:


=={{header|Kotlin}}==
=={{header|Kotlin}}==
<syntaxhighlight lang="kotlin">import kotlin.math.pow
<lang scala>// version 1.0.6


fun main(args: Array<String>) {
fun main() {
println("0 ^ 0 = ${Math.pow(0.0, 0.0)}")
println(0.0.pow(0))
}</lang>
}</syntaxhighlight>


{{out}}
{{out}}
<pre>
<pre>
0 ^ 0 = 1.0
1.0
</pre>
</pre>


=={{header|Lambdatalk}}==
=={{header|Lambdatalk}}==
<syntaxhighlight lang="scheme">
<lang Scheme>
{pow 0 0}
{pow 0 0}
-> 1
-> 1
{exp 0 0}
{exp 0 0}
-> 1
-> 1
</syntaxhighlight>
</lang>

=={{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}}==
=={{header|Liberty BASIC}}==
<syntaxhighlight lang="lb">
<lang lb>
'********
'********
print 0^0
print 0^0
'********
'********
</syntaxhighlight>
</lang>
{{out}}
{{out}}
<pre>1</pre>
<pre>1</pre>
Line 775: Line 919:
=={{header|Locomotive Basic}}==
=={{header|Locomotive Basic}}==


<lang locobasic>print 0🠅0</lang>
<syntaxhighlight lang="locobasic">print 0🠅0</syntaxhighlight>
{{out}}
{{out}}
<pre> 1</pre>
<pre> 1</pre>
Line 781: Line 925:
=={{header|Lua}}==
=={{header|Lua}}==
No need to try different data types or with / without decimal points as all numbers in Lua are stored in double-precision floating-point format.
No need to try different data types or with / without decimal points as all numbers in Lua are stored in double-precision floating-point format.
<lang Lua>print(0^0)</lang>
<syntaxhighlight lang="lua">print(0^0)</syntaxhighlight>
{{out}}
{{out}}
<pre>1</pre>
<pre>1</pre>
Line 787: Line 931:
=={{header|M2000 Interpreter}}==
=={{header|M2000 Interpreter}}==
M2000 use ** and ^ for power.
M2000 use ** and ^ for power.
<syntaxhighlight lang="m2000 interpreter">
<lang M2000 Interpreter>
Module Checkit {
Module Checkit {
x=0
x=0
Line 794: Line 938:
}
}
Checkit
Checkit
</syntaxhighlight>
</lang>


=={{header|Maple}}==
=={{header|Maple}}==
<lang Maple>0^0</lang>
<syntaxhighlight lang="maple">0^0</syntaxhighlight>
{{out}}
{{out}}
<pre>1</pre>
<pre>1</pre>


However, for consistency with IEEE-754 numerics, we also have a NaN result for the equivalent floating-point exponentiation:
However, for consistency with IEEE-754 numerics, we also have a NaN result for the equivalent floating-point exponentiation:
<lang Maple>0^0.0</lang>
<syntaxhighlight lang="maple">0^0.0</syntaxhighlight>
{{out}}
{{out}}
<pre>Float(undefined)</pre>
<pre>Float(undefined)</pre>


=={{header|Mathematica}}/{{header|Wolfram Language}}==
=={{header|Mathematica}}/{{header|Wolfram Language}}==
<lang Mathematica>0^0</lang>
<syntaxhighlight lang="mathematica">0^0</syntaxhighlight>
{{out}}
{{out}}
<pre>Indeterminate</pre>
<pre>Indeterminate</pre>


=={{header|MATLAB}} / {{header|Octave}}==
=={{header|MATLAB}} / {{header|Octave}}==
<syntaxhighlight lang="matlab">0^0
<lang Matlab>0^0
complex(0,0)^0</lang>
complex(0,0)^0</syntaxhighlight>
{{out}}
{{out}}
<pre>1
<pre>1
1</pre>
1</pre>
=={{header|Maxima}}==
=={{header|Maxima}}==
<lang maxima>0^0;</lang>
<syntaxhighlight lang="maxima">0^0;</syntaxhighlight>
{{out}}<pre> 0
{{out}}<pre> 0
expt: undefined: 0</pre>
expt: undefined: 0</pre>


=={{header|Mercury}}==
=={{header|Mercury}}==
<lang Mercury>:- module zero_to_the_zero_power.
<syntaxhighlight lang="mercury">:- module zero_to_the_zero_power.
:- interface.
:- interface.


Line 840: Line 984:
io.format(" float.pow(0.0, 0) = %.1f\n", [f(pow(0.0, 0))], !IO).
io.format(" float.pow(0.0, 0) = %.1f\n", [f(pow(0.0, 0))], !IO).


:- end_module zero_to_the_zero_power.</lang>
:- end_module zero_to_the_zero_power.</syntaxhighlight>
{{out}}
{{out}}
<pre> int.pow(0, 0) = 1
<pre> int.pow(0, 0) = 1
Line 847: Line 991:


=={{header|Microsoft Small Basic}}==
=={{header|Microsoft Small Basic}}==
<lang smallbasic>TextWindow.WriteLine(Math.Power(0,0))</lang>
<syntaxhighlight lang="smallbasic">TextWindow.WriteLine(Math.Power(0,0))</syntaxhighlight>
{{out}}<pre>1</pre>
{{out}}<pre>1</pre>


=={{header|min}}==
=={{header|min}}==
{{works with|min|0.19.3}}
{{works with|min|0.19.3}}
<lang min>0 0 pow puts</lang>
<syntaxhighlight lang="min">0 0 pow puts</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>
Line 859: Line 1,003:


=={{header|MiniScript}}==
=={{header|MiniScript}}==
<lang MiniScript>print "The result of zero to the zero power is " + 0^0</lang>
<syntaxhighlight lang="miniscript">print "The result of zero to the zero power is " + 0^0</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>
Line 866: Line 1,010:


=={{header|МК-61/52}}==
=={{header|МК-61/52}}==
<lang>Сx ^ x^y С/П</lang>
<syntaxhighlight lang="text">Сx ^ x^y С/П</syntaxhighlight>


The result is error message.
The result is error message.


=={{header|Nanoquery}}==
=={{header|Nanoquery}}==
<lang nanoquery>println 0^0</lang>
<syntaxhighlight lang="nanoquery">println 0^0</syntaxhighlight>
{{out}}
{{out}}
<pre>1</pre>
<pre>1</pre>
Line 878: Line 1,022:
Neko uses the C math library for exponentiation, Zero to the zero in math.pow(x, y) is treated as being 1.
Neko uses the C math library for exponentiation, Zero to the zero in math.pow(x, y) is treated as being 1.


<syntaxhighlight lang="actionscript">/**
<lang ActionScript>/**
Zero to the zeroth power, in Neko
Zero to the zeroth power, in Neko
*/
*/
Line 884: Line 1,028:
var math_pow = $loader.loadprim("std@math_pow", 2)
var math_pow = $loader.loadprim("std@math_pow", 2)


$print(math_pow(0, 0), "\n")</lang>
$print(math_pow(0, 0), "\n")</syntaxhighlight>


{{out}}
{{out}}
Line 892: Line 1,036:


=={{header|NetRexx}}==
=={{header|NetRexx}}==
<lang netrexx>x=0
<syntaxhighlight lang="netrexx">x=0
Say '0**0='||x**x</lang>
Say '0**0='||x**x</syntaxhighlight>
{{out}}
{{out}}
<pre>0**0=1</pre>
<pre>0**0=1</pre>


=={{header|NewLISP}}==
=={{header|NewLISP}}==
<lang newlisp>(pow 0 0)</lang>
<syntaxhighlight lang="newlisp">(pow 0 0)</syntaxhighlight>
{{out}}
{{out}}
<pre>1</pre>
<pre>1</pre>
Line 906: Line 1,050:
Create an exponentiation table for all type combinations (of integer <code>0</code>, float <code>0.0</code> and boolean <code>o</code>):
Create an exponentiation table for all type combinations (of integer <code>0</code>, float <code>0.0</code> and boolean <code>o</code>):


<lang nial> 0 0.0 o outer power 0 0.0 o
<syntaxhighlight lang="nial"> 0 0.0 o outer power 0 0.0 o
+--+--+--+
+--+--+--+
| 1|1.| 1|
| 1|1.| 1|
Line 913: Line 1,057:
+--+--+--+
+--+--+--+
| 1|1.| 1|
| 1|1.| 1|
+--+--+--+</lang>
+--+--+--+</syntaxhighlight>


=={{header|Nim}}==
=={{header|Nim}}==
<lang nim>import math
<syntaxhighlight lang="nim">import math


echo pow(0.0, 0.0) # Floating point exponentiation.
echo pow(0.0, 0.0) # Floating point exponentiation.
echo 0 ^ 0 # Integer exponentiation.</lang>
echo 0 ^ 0 # Integer exponentiation.</syntaxhighlight>
{{out}}
{{out}}
<pre>1.0
<pre>1.0
Line 939: Line 1,083:
=={{header|Oforth}}==
=={{header|Oforth}}==


<lang Oforth>0 0 pow println</lang>
<syntaxhighlight lang="oforth">0 0 pow println</syntaxhighlight>


{{out}}
{{out}}
Line 947: Line 1,091:


=={{header|Ol}}==
=={{header|Ol}}==
<lang scheme>
<syntaxhighlight lang="scheme">
(print "0^0: " (expt 0 0))
(print "0^0: " (expt 0 0))
(print "0.0^0: " (expt (inexact 0) 0))
(print "0.0^0: " (expt (inexact 0) 0))
</syntaxhighlight>
</lang>
{{out}}
{{out}}
<pre>
<pre>
Line 958: Line 1,102:


=={{header|ooRexx}}==
=={{header|ooRexx}}==
<lang oorexx>/**********************************************************************
<syntaxhighlight lang="oorexx">/**********************************************************************
* 21.04.2014 Walter Pachl
* 21.04.2014 Walter Pachl
**********************************************************************/
**********************************************************************/
Say 'rxCalcpower(0,0) ->' rxCalcpower(0,0)
Say 'rxCalcpower(0,0) ->' rxCalcpower(0,0)
Say '0**0 ->' 0**0
Say '0**0 ->' 0**0
::requires rxmath library</lang>
::requires rxmath library</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>
Line 969: Line 1,113:
0**0 -> 1
0**0 -> 1
</pre>
</pre>


=={{header|Openscad}}==
<syntaxhighlight lang="openscad">echo (0^0);</syntaxhighlight>



=={{header|PARI/GP}}==
=={{header|PARI/GP}}==
0 raised to the power of exact 0 is 0, but 0 cannot be raised to the power of an inexact 0:
0 raised to the power of exact 0 is 1, but 0 cannot be raised to the power of an inexact 0:
<lang parigp>0^0
<syntaxhighlight lang="parigp">0^0
0.^0
0.^0
0^0.</lang>
0^0.</syntaxhighlight>
{{out}}
{{out}}
<pre>%1 = 1
<pre>%1 = 1
Line 985: Line 1,134:
=={{header|Pascal}}==
=={{header|Pascal}}==
{{works with|Free Pascal}} {{Libheader|math}}
{{works with|Free Pascal}} {{Libheader|math}}
<lang Pascal>program ZToZ;
<syntaxhighlight lang="pascal">program ZToZ;
uses
uses
math;
math;
Line 991: Line 1,140:
write('0.0 ^ 0 :',IntPower(0.0,0):4:2);
write('0.0 ^ 0 :',IntPower(0.0,0):4:2);
writeln(' 0.0 ^ 0.0 :',Power(0.0,0.0):4:2);
writeln(' 0.0 ^ 0.0 :',Power(0.0,0.0):4:2);
end.</lang>
end.</syntaxhighlight>
;output:
;output:
<pre>0.0 ^ 0 :1.00 0.0 ^ 0.0 :1.00</pre>
<pre>0.0 ^ 0 :1.00 0.0 ^ 0.0 :1.00</pre>


=={{header|Perl}}==
=={{header|Perl}}==
<lang perl>print 0 ** 0, "\n";
<syntaxhighlight lang="perl">print 0 ** 0, "\n";


use Math::Complex;
use Math::Complex;


print cplx(0,0) ** cplx(0,0), "\n";</lang>
print cplx(0,0) ** cplx(0,0), "\n";</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>
Line 1,009: Line 1,158:
=={{header|Phix}}==
=={{header|Phix}}==
{{libheader|Phix/basics}}
{{libheader|Phix/basics}}
<!--<lang Phix>(phixonline)-->
<!--<syntaxhighlight lang="phix">(phixonline)-->
<span style="color: #0000FF;">?</span><span style="color: #7060A8;">power</span><span style="color: #0000FF;">(</span><span style="color: #000000;">0</span><span style="color: #0000FF;">,</span><span style="color: #000000;">0</span><span style="color: #0000FF;">)</span>
<span style="color: #0000FF;">?</span><span style="color: #7060A8;">power</span><span style="color: #0000FF;">(</span><span style="color: #000000;">0</span><span style="color: #0000FF;">,</span><span style="color: #000000;">0</span><span style="color: #0000FF;">)</span>
<span style="color: #7060A8;">requires</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"0.8.4"</span><span style="color: #0000FF;">)</span> <span style="color: #000080;font-style:italic;">-- (now fixed/crashes on earlier versions)</span>
<span style="color: #7060A8;">requires</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"0.8.4"</span><span style="color: #0000FF;">)</span> <span style="color: #000080;font-style:italic;">-- (now fixed/crashes on earlier versions)</span>
Line 1,018: Line 1,167:
<span style="color: #000000;">sb</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">complex_sprint</span><span style="color: #0000FF;">(</span><span style="color: #000000;">b</span><span style="color: #0000FF;">,</span><span style="color: #004600;">true</span><span style="color: #0000FF;">)</span>
<span style="color: #000000;">sb</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">complex_sprint</span><span style="color: #0000FF;">(</span><span style="color: #000000;">b</span><span style="color: #0000FF;">,</span><span style="color: #004600;">true</span><span style="color: #0000FF;">)</span>
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"%s ^ %s = %s\n"</span><span style="color: #0000FF;">,{</span><span style="color: #000000;">sa</span><span style="color: #0000FF;">,</span><span style="color: #000000;">sa</span><span style="color: #0000FF;">,</span><span style="color: #000000;">sb</span><span style="color: #0000FF;">})</span>
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"%s ^ %s = %s\n"</span><span style="color: #0000FF;">,{</span><span style="color: #000000;">sa</span><span style="color: #0000FF;">,</span><span style="color: #000000;">sa</span><span style="color: #0000FF;">,</span><span style="color: #000000;">sb</span><span style="color: #0000FF;">})</span>
<!--</lang>-->
<!--</syntaxhighlight>-->
{{out}}
{{out}}
<pre>
<pre>
Line 1,026: Line 1,175:


=={{header|Phixmonti}}==
=={{header|Phixmonti}}==
<lang Phixmonti>def mypower
<syntaxhighlight lang="phixmonti">def mypower
dup not if
dup not if
. sign dup 0 == if . 1 endif
. sign dup 0 == if . 1 endif
Line 1,034: Line 1,183:
enddef
enddef


0 0 mypower print</lang>
0 0 mypower print</syntaxhighlight>
{{out}}
{{out}}
<pre>1</pre>
<pre>1</pre>


=={{header|PHP}}==
=={{header|PHP}}==
<lang PHP><?php
<syntaxhighlight lang="php"><?php
echo pow(0,0);
echo pow(0,0);
echo 0 ** 0; // PHP 5.6+ only
echo 0 ** 0; // PHP 5.6+ only
?></lang>
?></syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>
Line 1,050: Line 1,199:


=={{header|PicoLisp}}==
=={{header|PicoLisp}}==
<syntaxhighlight lang="picolisp">
<lang PicoLisp>
(** 0 0)
(** 0 0)
</syntaxhighlight>
</lang>
{{out}}
{{out}}
1
1


=={{header|Pike}}==
=={{header|Pike}}==
<lang Pike>write( pow(0, 0) +"\n" );</lang>
<syntaxhighlight lang="pike">write( pow(0, 0) +"\n" );</syntaxhighlight>
{{Out}}
{{Out}}
<pre>
<pre>
Line 1,064: Line 1,213:


=={{header|PL/I}}==
=={{header|PL/I}}==
<lang pli> zhz: Proc Options(Main);
<syntaxhighlight lang="pli"> zhz: Proc Options(Main);
Dcl a dec float(10) Init(1);
Dcl a dec float(10) Init(1);
Dcl b dec float(10) Init(0);
Dcl b dec float(10) Init(0);
Line 1,070: Line 1,219:
Put skip list('0**1=',b**a);
Put skip list('0**1=',b**a);
Put skip list('0**0=',b**b);
Put skip list('0**0=',b**b);
End;</lang>
End;</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>
Line 1,081: Line 1,230:


=={{header|Plain English}}==
=={{header|Plain English}}==
<lang plainenglish>To run:
<syntaxhighlight lang="plainenglish">To run:
Start up.
Start up.
Put 0 into a number.
Put 0 into a number.
Line 1,088: Line 1,237:
Write the string to the console.
Write the string to the console.
Wait for the escape key.
Wait for the escape key.
Shut down.</lang>
Shut down.</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>
Line 1,096: Line 1,245:
=={{header|PowerShell}}==
=={{header|PowerShell}}==


<lang powershell>Write-Host "0 ^ 0 = " ([math]::pow(0,0))</lang>
<syntaxhighlight lang="powershell">Write-Host "0 ^ 0 = " ([math]::pow(0,0))</syntaxhighlight>


Output :
Output :
Line 1,105: Line 1,254:


=={{header|PureBasic}}==
=={{header|PureBasic}}==
<syntaxhighlight lang="purebasic">
<lang PureBasic>
If OpenConsole()
If OpenConsole()
PrintN("Zero to the zero power is " + Pow(0,0))
PrintN("Zero to the zero power is " + Pow(0,0))
Line 1,113: Line 1,262:
CloseConsole()
CloseConsole()
EndIf
EndIf
</syntaxhighlight>
</lang>


{{out}}
{{out}}
Line 1,121: Line 1,270:


=={{header|Pyret}}==
=={{header|Pyret}}==
<lang Pyret>num-expt(0, 0)</lang>
<syntaxhighlight lang="pyret">num-expt(0, 0)</syntaxhighlight>
{{out}}
{{out}}
1
1
Line 1,127: Line 1,276:
=={{header|Python}}==
=={{header|Python}}==
===Python3===
===Python3===
<lang python>from decimal import Decimal
<syntaxhighlight lang="python">from decimal import Decimal
from fractions import Fraction
from fractions import Fraction
from itertools import product
from itertools import product
Line 1,137: Line 1,286:
except:
except:
ans = '<Exception raised>'
ans = '<Exception raised>'
print(f'{i!r:>15} ** {j!r:<15} = {ans!r}')</lang>
print(f'{i!r:>15} ** {j!r:<15} = {ans!r}')</syntaxhighlight>
{{out}}
{{out}}
<pre> 0 ** 0 = 1
<pre> 0 ** 0 = 1
Line 1,205: Line 1,354:


===Python2===
===Python2===
<lang python>from decimal import Decimal
<syntaxhighlight lang="python">from decimal import Decimal
from fractions import Fraction
from fractions import Fraction
for n in (Decimal(0), Fraction(0, 1), complex(0), float(0), int(0)):
for n in (Decimal(0), Fraction(0, 1), complex(0), float(0), int(0)):
Line 1,216: Line 1,365:
except:
except:
n2 = '<Raised exception>'
n2 = '<Raised exception>'
print('%8s: ** -> %r; pow -> %r' % (n.__class__.__name__, n1, n2))</lang>
print('%8s: ** -> %r; pow -> %r' % (n.__class__.__name__, n1, n2))</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>
Line 1,227: Line 1,376:


=={{header|QB64}}==
=={{header|QB64}}==
<lang qb64>Print 0 ^ 0</lang>
<syntaxhighlight lang="qb64">Print 0 ^ 0</syntaxhighlight>
{{out}}
{{out}}
<pre>1</pre>
<pre>1</pre>
Alternatively:
Alternatively:
<lang QB64>i% = 0 'Integer
<syntaxhighlight lang="qb64">i% = 0 'Integer
l& = 0 'Long integer
l& = 0 'Long integer
s! = 0.0 'Single precision floating point
s! = 0.0 'Single precision floating point
Line 1,245: Line 1,394:
Print b` ^ b`
Print b` ^ b`
Print bb%% ^ bb%%
Print bb%% ^ bb%%
Print isf&& ^ isf&&</lang>
Print isf&& ^ isf&&</syntaxhighlight>
{{out}}
{{out}}
NB: Values with 0 decimals are trimmed by Print's casting from number value to String.
NB: Values with 0 decimals are trimmed by Print's casting from number value to String.
Line 1,259: Line 1,408:
As a dialogue in the Quackery shell.
As a dialogue in the Quackery shell.


<lang Quackery>/O> 0 0 **
<syntaxhighlight lang="quackery">/O> 0 0 **
...
...


Stack: 1
Stack: 1
</syntaxhighlight>
</lang>


=={{header|R}}==
=={{header|R}}==
<lang rsplus>print(0^0)</lang>
<syntaxhighlight lang="rsplus">print(0^0)</syntaxhighlight>
{{out}}
{{out}}
<pre>1</pre>
<pre>1</pre>
Line 1,272: Line 1,421:
=={{header|Racket}}==
=={{header|Racket}}==


<lang racket>#lang racket
<syntaxhighlight lang="racket">#lang racket
;; as many zeros as I can think of...
;; as many zeros as I can think of...
(define zeros (list
(define zeros (list
Line 1,285: Line 1,434:
(printf "(~a)^(~a) = ~s~%" z p
(printf "(~a)^(~a) = ~s~%" z p
(with-handlers [(exn:fail:contract:divide-by-zero? exn-message)]
(with-handlers [(exn:fail:contract:divide-by-zero? exn-message)]
(expt z p))))</lang>
(expt z p))))</syntaxhighlight>


{{out}}
{{out}}
Line 1,329: Line 1,478:


{{works with|Rakudo|2018.03}}
{{works with|Rakudo|2018.03}}
<lang perl6>say ' type n n**n exp(n,n)';
<syntaxhighlight lang="raku" line>say ' type n n**n exp(n,n)';
say '-------- -------- -------- --------';
say '-------- -------- -------- --------';


for 0, 0.0, FatRat.new(0), 0e0, 0+0i {
for 0, 0.0, FatRat.new(0), 0e0, 0+0i {
printf "%8s %8s %8s %8s\n", .^name, $_, $_**$_, exp($_,$_);
printf "%8s %8s %8s %8s\n", .^name, $_, $_**$_, exp($_,$_);
}</lang>
}</syntaxhighlight>


{{out}}
{{out}}
Line 1,349: Line 1,498:
=={{header|Red}}==
=={{header|Red}}==
Shown using the operator, the function, and the <code>math</code> mini-DSL that uses the order of operations from mathematics:
Shown using the operator, the function, and the <code>math</code> mini-DSL that uses the order of operations from mathematics:
<lang rebol>Red[]
<syntaxhighlight lang="rebol">Red[]
print 0 ** 0
print 0 ** 0
print power 0 0
print power 0 0
print math [0 ** 0]</lang>
print math [0 ** 0]</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>
Line 1,361: Line 1,510:


=={{header|Relation}}==
=={{header|Relation}}==
<syntaxhighlight lang="relation">
<lang Relation>
echo pow(0,0)
echo pow(0,0)
// 1
// 1
</syntaxhighlight>
</lang>


=={{header|REXX}}==
=={{header|REXX}}==
<lang rexx>/*REXX program shows the results of raising zero to the zeroth power.*/
<syntaxhighlight lang="rexx">/*REXX program shows the results of raising zero to the zeroth power.*/
say '0 ** 0 (zero to the zeroth power) ───► ' 0**0</lang>
say '0 ** 0 (zero to the zeroth power) ───► ' 0**0</syntaxhighlight>
<br>using PC/REXX
<br>using PC/REXX
<br>using Personal REXX
<br>using Personal REXX
Line 1,399: Line 1,548:


=={{header|Ring}}==
=={{header|Ring}}==
<lang ring>
<syntaxhighlight lang="ring">
x = 0
x = 0
y = 0
y = 0
z = pow(x,y)
z = pow(x,y)
see "z=" + z + nl # z=1
see "z=" + z + nl # z=1
</syntaxhighlight>
</lang>

=={{header|RPL}}==
0 0 ^
====Output for HP-48G and older models====
1: 1
====Output for HP-49 and newer models====
1: ?


=={{header|Ruby}}==
=={{header|Ruby}}==
<lang ruby>require 'bigdecimal'
<syntaxhighlight lang="ruby">require 'bigdecimal'


[0, 0.0, Complex(0), Rational(0), BigDecimal.new("0")].each do |n|
[0, 0.0, Complex(0), Rational(0), BigDecimal("0")].each do |n|
printf "%10s: ** -> %s\n" % [n.class, n**n]
printf "%10s: ** -> %s\n" % [n.class, n**n]
end</lang>
end</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>
Fixnum: ** -> 1
Integer: ** -> 1
Float: ** -> 1.0
Float: ** -> 1.0
Complex: ** -> 1+0i
Complex: ** -> 1+0i
Rational: ** -> 1/1
Rational: ** -> 1/1
BigDecimal: ** -> 0.1E1
BigDecimal: ** -> 0.1e1
</pre>
</pre>


=={{header|Rust}}==
=={{header|Rust}}==
<lang rust>fn main() {
<syntaxhighlight lang="rust">fn main() {
println!("{}",0u32.pow(0));
println!("{}",0u32.pow(0));
}</lang>
}</syntaxhighlight>


{{out}}
{{out}}
Line 1,430: Line 1,586:


=={{header|S-lang}}==
=={{header|S-lang}}==
<lang S-lang>print(0^0);</lang>
<syntaxhighlight lang="s-lang">print(0^0);</syntaxhighlight>
{{out}}
{{out}}
<pre>1.0</pre>
<pre>1.0</pre>


=={{header|Scala}}==
=={{header|Scala}}==
{{libheader|Scala}}<lang Scala> assert(math.pow(0, 0) == 1, "Scala blunder, should go back to school !")</lang>
{{libheader|Scala}}<syntaxhighlight lang="scala"> assert(math.pow(0, 0) == 1, "Scala blunder, should go back to school !")</syntaxhighlight>


=={{header|Scheme}}==
=={{header|Scheme}}==
<lang scheme>(display (expt 0 0)) (newline)
<syntaxhighlight lang="scheme">(display (expt 0 0)) (newline)
(display (expt 0.0 0.0)) (newline)
(display (expt 0.0 0.0)) (newline)
(display (expt 0+0i 0+0i)) (newline)</lang>
(display (expt 0+0i 0+0i)) (newline)</syntaxhighlight>
{{out}}
{{out}}
<pre>1
<pre>1
Line 1,447: Line 1,603:


=={{header|Seed7}}==
=={{header|Seed7}}==
<lang seed7>$ include "seed7_05.s7i";
<syntaxhighlight lang="seed7">$ include "seed7_05.s7i";
include "float.s7i";
include "float.s7i";
include "complex.s7i";
include "complex.s7i";
Line 1,458: Line 1,614:
writeln("0.0+0i ** 0 = " <& complex(0.0) ** 0);
writeln("0.0+0i ** 0 = " <& complex(0.0) ** 0);
end func;
end func;
</syntaxhighlight>
</lang>


{{out}}
{{out}}
Line 1,469: Line 1,625:


=={{header|SenseTalk}}==
=={{header|SenseTalk}}==
<lang sensetalk>set a to 0
<syntaxhighlight lang="sensetalk">set a to 0
set b to 0
set b to 0


put a to the power of b
put a to the power of b
// Prints: 1</lang>
// Prints: 1</syntaxhighlight>


=={{header|Sidef}}==
=={{header|Sidef}}==
<lang ruby>[0, Complex(0, 0)].each {|n|
<syntaxhighlight lang="ruby">[0, Complex(0, 0)].each {|n|
say n**n
say n**n
}</lang>
}</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>
Line 1,487: Line 1,643:
Taking the 0'th root of a number and raising it back to the zero power, we also get a 1:
Taking the 0'th root of a number and raising it back to the zero power, we also get a 1:


<lang ruby>say 0.root(0).pow(0) # => 1
<syntaxhighlight lang="ruby">say 0.root(0).pow(0) # => 1
say ((0**(1/0))**0) # => 1</lang>
say ((0**(1/0))**0) # => 1</syntaxhighlight>


=={{header|Sinclair ZX81 BASIC}}==
=={{header|Sinclair ZX81 BASIC}}==
<lang basic>PRINT 0**0</lang>
<syntaxhighlight lang="basic">PRINT 0**0</syntaxhighlight>
{{out}}
{{out}}
<pre>1</pre>
<pre>1</pre>
Line 1,497: Line 1,653:
=={{header|Smalltalk}}==
=={{header|Smalltalk}}==


<lang smalltalk>
<syntaxhighlight lang="smalltalk">
0 raisedTo: 0
0 raisedTo: 0
0.0 raisedTo: 0.0
0.0 raisedTo: 0.0
</syntaxhighlight>
</lang>
{{out}}
{{out}}
<pre>
<pre>
Line 1,508: Line 1,664:


=={{header|smart BASIC}}==
=={{header|smart BASIC}}==
<lang qbasic>PRINT 0^0</lang>
<syntaxhighlight lang="qbasic">PRINT 0^0</syntaxhighlight>


{{out}}
{{out}}
Line 1,515: Line 1,671:
</pre>
</pre>


=={{header|SQL}}==


=={{header|SNOBOL4}}==
<lang SQL>
<syntaxhighlight lang="snobol4"> OUTPUT = (0 ** 0)
END</syntaxhighlight>


=={{header|SQL}}==
<syntaxhighlight lang="sql">
SQL> select power(0,0) from dual;
SQL> select power(0,0) from dual;
</syntaxhighlight>
</lang>
{{out}}
{{out}}
<pre>
<pre>
Line 1,535: Line 1,696:


=={{header|Stata}}==
=={{header|Stata}}==
<lang stata>. display 0^0
<syntaxhighlight lang="stata">. display 0^0
1</lang>
1</syntaxhighlight>


=={{header|Swift}}==
=={{header|Swift}}==
<lang swift>import Darwin
<syntaxhighlight lang="swift">import Darwin
print(pow(0.0,0.0))</lang>
print(pow(0.0,0.0))</syntaxhighlight>
{{out}}
{{out}}
<pre>1.0</pre>
<pre>1.0</pre>


=={{header|Symsyn}}==
=={{header|Symsyn}}==
<syntaxhighlight lang="symsyn">
<lang Symsyn>
(0^0) []
(0^0) []
</syntaxhighlight>
</lang>
{{out}}
{{out}}
<pre> 1 </pre>
<pre> 1 </pre>
Line 1,553: Line 1,714:
=={{header|Tcl}}==
=={{header|Tcl}}==
Interactively…
Interactively…
<lang tcl>% expr 0**0
<syntaxhighlight lang="tcl">% expr 0**0
1
1
% expr 0.0**0.0
% expr 0.0**0.0
1.0</lang>
1.0</syntaxhighlight>

=={{header|TI SR-56}}==
<syntaxhighlight lang="text">0 Yx 0 =</syntaxhighlight>

{{out}}
<pre> 1 </pre>


=={{header|TI-83_BASIC}}==
=={{header|TI-83_BASIC}}==
<lang tibasic>0^0</lang>
<syntaxhighlight lang="tibasic">0^0</syntaxhighlight>
{{out}}
{{out}}
<pre>ERROR:DOMAIN</pre>
<pre>ERROR:DOMAIN</pre>


=={{header|uBasic/4tH}}==
=={{header|uBasic/4tH}}==
<lang>Print 0^0</lang>
<syntaxhighlight lang="text">Print 0^0</syntaxhighlight>
{{out}}
{{out}}
<pre>1
<pre>1
Line 1,572: Line 1,739:
=={{header|Ursa}}==
=={{header|Ursa}}==
Cygnus/X Ursa is written in Java, and as a result returns 1.0 when raising 0 to the 0.
Cygnus/X Ursa is written in Java, and as a result returns 1.0 when raising 0 to the 0.
<lang ursa>> out (pow 0 0) endl console
<syntaxhighlight lang="ursa">> out (pow 0 0) endl console
1.0</lang>
1.0</syntaxhighlight>


=={{header|VBA}}==
=={{header|VBA}}==
<lang vb>Public Sub zero()
<syntaxhighlight lang="vb">Public Sub zero()
x = 0
x = 0
y = 0
y = 0
z = 0 ^ 0
z = 0 ^ 0
Debug.Print "z ="; z
Debug.Print "z ="; z
End Sub</lang>{{out}}
End Sub</syntaxhighlight>{{out}}
<pre>z = 1</pre>
<pre>z = 1</pre>


=={{header|VBScript}}==
=={{header|VBScript}}==
<lang vb>WScript.Echo 0 ^ 0</lang>
<syntaxhighlight lang="vb">WScript.Echo 0 ^ 0</syntaxhighlight>
{{Out}}
{{Out}}
<pre>1</pre>
<pre>1</pre>


=={{header|Verilog}}==
<syntaxhighlight lang="verilog">module main;
initial begin
$display("0 ^ 0 = ", 0**0);
$finish ;
end
endmodule</syntaxhighlight>
{{out}}
<pre>0 ^ 0 = 1</pre>



=={{header|Visual Basic .NET}}==
=={{header|Visual Basic .NET}}==
<lang vbnet>Module Program
<syntaxhighlight lang="vbnet">Module Program
Sub Main()
Sub Main()
Console.Write(0^0)
Console.Write(0^0)
End Sub
End Sub
End Module</lang>
End Module</syntaxhighlight>


{{out}}
{{out}}
<pre>1</pre>
<pre>1</pre>

=={{header|V (Vlang)}}==
<syntaxhighlight lang="go">// Zero to the zero power, in V
// Tectonics: v run zero-to-the-zero-power.v
module main
import math

// starts here
// V does not include an exponentiation operator, but uses a math module
pub fn main() {
println(math.pow(0, 0))
}</syntaxhighlight>
{{out}}<pre>prompt$ v run rosetta/zero-to-the-zero-power.v
1.</pre>


=={{header|Wren}}==
=={{header|Wren}}==
<lang ecmascript>System.print(0.pow(0))</lang>
<syntaxhighlight lang="wren">System.print(0.pow(0))</syntaxhighlight>


{{out}}
{{out}}
Line 1,608: Line 1,801:


=={{header|XLISP}}==
=={{header|XLISP}}==
<lang scheme>XLISP 3.3, September 6, 2002 Copyright (c) 1984-2002, by David Betz
<syntaxhighlight lang="scheme">XLISP 3.3, September 6, 2002 Copyright (c) 1984-2002, by David Betz
[1] (expt 0 0)
[1] (expt 0 0)


1
1
[2] </lang>
[2] </syntaxhighlight>


=={{header|XPL0}}==
=={{header|XPL0}}==
<lang XPL0>RlOut(0, Pow(0., 0.))</lang>
<syntaxhighlight lang="xpl0">RlOut(0, Pow(0., 0.))</syntaxhighlight>
{{out}}
{{out}}
<pre> 1.00000</pre>
<pre> 1.00000</pre>

=={{header|Zig}}==
<syntaxhighlight lang="zig">const std = @import("std");

pub fn main() !void {
const stdout = std.io.getStdOut().writer();
try stdout.print("0^0 = {d:.8}\n", .{std.math.pow(f32, 0, 0)});
}</syntaxhighlight>
{{out}}
<pre>0^0 = 1.00000000</pre>


=={{header|zkl}}==
=={{header|zkl}}==
<lang zkl>(0.0).pow(0) //--> 1.0
<syntaxhighlight lang="zkl">(0.0).pow(0) //--> 1.0
var BN=Import("zklBigNum"); // big ints
var BN=Import("zklBigNum"); // big ints
BN(0).pow(0) //--> 1</lang>
BN(0).pow(0) //--> 1</syntaxhighlight>

Latest revision as of 14:50, 1 March 2024

Task
Zero to the zero power
You are encouraged to solve this task according to the task description, using any language you may know.

Some computer programming languages are not exactly consistent   (with other computer programming languages)  
when   raising zero to the zeroth power:     00


Task

Show the results of raising   zero   to the   zeroth   power.


If your computer language objects to     0**0     or     0^0     at compile time,   you may also try something like:

           x = 0
           y = 0
           z = x**y
           say  'z='  z


Show the result here.
And of course use any symbols or notation that is supported in your computer programming language for exponentiation.


See also



11l

print(0 ^ 0)
Output:
1

8th

0 0 ^ .
Output:

1

Action!

INCLUDE "D2:REAL.ACT" ;from the Action! Tool Kit

PROC Main()
  REAL z,res

  Put(125) PutE() ;clear the screen

  IntToReal(0,z)
  Power(z,z,res)

  PrintR(z) Print("^")
  PrintR(z) Print("=")
  PrintRE(res)
RETURN
Output:

Screenshot from Atari 8-bit computer

0^0=.9999999998

Ada

with Ada.Text_IO, Ada.Integer_Text_IO, Ada.Long_Integer_Text_IO,
  Ada.Long_Long_Integer_Text_IO, Ada.Float_Text_IO, Ada.Long_Float_Text_IO,
  Ada.Long_Long_Float_Text_IO;
use  Ada.Text_IO, Ada.Integer_Text_IO, Ada.Long_Integer_Text_IO,
  Ada.Long_Long_Integer_Text_IO, Ada.Float_Text_IO, Ada.Long_Float_Text_IO,
  Ada.Long_Long_Float_Text_IO;

procedure Test5 is

   I    : Integer           := 0;
   LI   : Long_Integer      := 0;
   LLI  : Long_Long_Integer := 0;
   F    : Float             := 0.0;
   LF   : Long_Float        := 0.0;
   LLF  : Long_Long_Float   := 0.0;
   Zero : Natural           := 0;

begin
   Put ("Integer           0^0 = "); 
   Put (I ** Zero, 2);   New_Line;
   Put ("Long Integer      0^0 = ");
   Put (LI ** Zero, 2);  New_Line;
   Put ("Long Long Integer 0^0 = ");
   Put (LLI ** Zero, 2); New_Line;
   Put ("Float           0.0^0 = ");           
   Put (F ** Zero);   New_Line;
   Put ("Long Float      0.0^0 = ");      
   Put (LF ** Zero);  New_Line;
   Put ("Long Long Float 0.0^0 = "); 
   Put (LLF ** Zero); New_Line;
end Test5;
Output:
Integer           0^0 =  1
Long Integer      0^0 =  1
Long Long Integer 0^0 =  1
Float           0.0^0 =  1.00000E+00
Long Float      0.0^0 =  1.00000000000000E+00
Long Long Float 0.0^0 =  1.00000000000000000E+00

ALGOL 68

Works with: ALGOL 68G version Any - tested with release 2.6.win32
print( ( 0 ^ 0, newline ) )
Output:
         +1

APL

      0*0
1

AppleScript

 return 0 ^ 0
Output:
1.0

Applesoft BASIC

]? 0^0
1

Arturo

print 0 ^ 0
print 0.0 ^ 0
Output:
1
1.0

Asymptote

write("0 ^ 0 = ", 0 ** 0);

AutoHotkey

MsgBox % 0 ** 0
Output:
1

AWK

# syntax: GAWK -f ZERO_TO_THE_ZERO_POWER.AWK
BEGIN {
    print(0 ^ 0)
    exit(0)
}
Output:
1

BaCon

PRINT POW(0, 0)
Output:
prompt$ ./zerotothezero
1

BASIC

BASIC256

print "0 ^ 0 = "; 0 ^ 0

Chipmunk Basic

10 print "0 ^ 0 = ";0^0

MSX Basic

10 PRINT "0 ^ 0 = "; 0 ^ 0

QBasic

Works with: QBasic version 1.1
Works with: QuickBasic version 4.5
PRINT "0 ^ 0 ="; 0 ^ 0

Run BASIC

Works with: Just BASIC
Works with: Liberty BASIC
print "0 ^ 0 = "; 0 ^ 0

True BASIC

Works with: QBasic
PRINT "0 ^ 0 ="; 0 ^ 0
END

XBasic

Works with: Windows 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

ZX Spectrum Basic

PRINT 0↑0
Output:
1

0 OK, 0:1

BBC BASIC

      PRINT 0^0
Output:
1

Bc

0 ^ 0
Output:

1

Befunge

Befunge-93 doesn't have explicit support for exponentiation, but there are a couple of fingerprint extensions for Befunge-98 which add that functionality. The example below makes use of the FPDP fingerprint (double precision floating point).

Note that the result is potentially dependent on the underlying language of the interpreter, but all those tested so far have returned 1. Interpreters that don't support Befunge-98, or don't support this fingerprint, should just terminate (possibly with a warning).

"PDPF"4#@(0F0FYP)@
Output:
1.000000

Binary Lambda Calculus

In lambda calculus, \n. n n 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 :

0001010110100000010110111011010

Output:

1

BQN

BQN doesn't specify the details of arithmetic functions; existing implementations use IEEE doubles and the pow function, giving a result of 1.

00
Output:
1

Bracmat

0^0
Output:
1

Burlesque

blsq ) 0.0 0.0?^
1.0
blsq ) 0 0?^
1

C

Works with: C99

This example uses the standard pow function in the math library. 0^0 is given as 1.

#include <stdio.h>
#include <math.h>
#include <complex.h>

int main()
{
	printf("0 ^ 0 = %f\n", pow(0,0));
        double complex c = cpow(0,0);
	printf("0+0i ^ 0+0i = %f+%fi\n", creal(c), cimag(c));
	return 0;
}
Output:
0 ^ 0 = 1.000000
0+0i ^ 0+0i = nan+nani

C#

using System;

namespace ZeroToTheZeroeth
{
    class Program
    {
        static void Main(string[] args)
        {
            double k = Math.Pow(0, 0);
            Console.Write("0^0 is {0}", k);           
        }
    }
}
Output:
0^0 is 1

C++

#include <iostream>
#include <cmath>
#include <complex>

int main()
{
  std::cout << "0 ^ 0 = " << std::pow(0,0) << std::endl;
  std::cout << "0+0i ^ 0+0i = " <<
    std::pow(std::complex<double>(0),std::complex<double>(0)) << std::endl;
  return 0;
}
Output:
0 ^ 0 = 1
0+0i ^ 0+0i = (nan,nan)

Caché ObjectScript

ZEROPOW
  // default behavior is incorrect:
  set (x,y) = 0
  w !,"0 to the 0th power (wrong): "_(x**y)  ; will output 0
  
  // if one or both of the values is a double, this works
  set (x,y) = $DOUBLE(0)
  w !,"0 to the 0th power (right): "_(x**y)
  
  quit
Output:
SAMPLES>do ^ZEROPOW

0 to the 0th power (wrong): 0

0 to the 0th power (right): 1

Clojure

user=> (use 'clojure.math.numeric-tower)
user=> (expt 0 0)
1

; alternative java-interop route:
user=> (Math/pow 0 0)
1.0

CLU

The CLU reference manual doesn't mention the issue, so the fact that it returns 1 in my case could just be an implementation detail.

start_up = proc ()
    zz_int: int := 0 ** 0
    zz_real: real := 0.0 ** 0.0
    
    po: stream := stream$primary_output()
    stream$putl(po, "integer 0**0: " || int$unparse(zz_int))
    stream$putl(po, "real 0**0: " || f_form(zz_real, 1, 1))
end start_up
Output:
integer 0**0: 1
real 0**0: 1.0

COBOL

identification division.
program-id. zero-power-zero-program.
data division.
working-storage section.
77  n                         pic 9.
procedure division.
    compute n = 0**0.
    display n upon console.
    stop run.
Output:
1

ColdFusion

Classic tag based CFML

<cfset zeroPowerTag = 0^0>
<cfoutput>"#zeroPowerTag#"</cfoutput>
Output:
"1"

Script Based CFML

<cfscript>
  zeroPower = 0^0;
  writeOutput( zeroPower );
</cfscript>
Output:
1

Commodore BASIC

Commodore computers use the up arrow key as the exponent operator.

Output:
ready.
print 0↑0
1

ready.
█


Common Lisp

> (expt 0 0)
1

Crystal

puts "Int32:            #{0_i32**0_i32}"
puts "Negative Int32:   #{-0_i32**-0_i32}"
puts "Float32:          #{0_f32**0_f32}"
puts "Negative Float32: #{-0_f32**-0_f32}"
Output:
Int32:            1
Negative Int32:   1
Float32:          1.0
Negative Float32: 1.0

D

void main() {
    import std.stdio, std.math, std.bigint, std.complex;

    writeln("Int:     ", 0 ^^ 0);
    writeln("Ulong:   ", 0UL ^^ 0UL);
    writeln("Float:   ", 0.0f ^^ 0.0f);
    writeln("Double:  ", 0.0 ^^ 0.0);
    writeln("Real:    ", 0.0L ^^ 0.0L);
    writeln("pow:     ", pow(0, 0));
    writeln("BigInt:  ", 0.BigInt ^^ 0);
    writeln("Complex: ", complex(0.0, 0.0) ^^ 0);
}
Output:
Int:     1
Ulong:   1
Float:   1
Double:  1
Real:    1
pow:     1
BigInt:  1
Complex: 1+0i

Dart

import 'dart:math';

void main() {
  var resul = pow(0, 0);
  print("0 ^ 0 = $resul");
}
Output:
0 ^ 0 = 1

Dc

0 0^p
Output:
1

Delphi

See Pascal.

EasyLang

print pow 0 0

EchoLisp

;; trying the 16 combinations
;; all return the integer 1

(lib 'bigint)
(define zeroes '(integer: 0 inexact=float: 0.000 complex: 0+0i bignum: #0))
(for* ((z1 zeroes) (z2 zeroes)) (write (expt z1 z2)))
      1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Eiffel

print (0^0)
Output:
1

Elena

ELENA 6.x

import extensions;
 
public program()
{
    console.printLine("0^0 is ",0.power(0))
}
Output:
0^0 is 0

Elixir

Elixir uses Erlang's :math for power operations and can handle zero to the zero power.

:math.pow(0,0)
Output:

1.0

Emacs Lisp

(expt 0 0)
Output:
1

EMal

writeLine(0 ** 0) # an integer
writeLine(0.0 ** 0.0) # a real
Output:
1
1.0

ERRE

.....
PRINT(0^0)
.....
Output:
 1

F#

In the REPL:

> let z = 0.**0.;;

val z : float = 1.0

Factor

USING: math.functions.private ; ! ^complex
0 0 ^
C{ 0 0 } C{ 0 0 } ^complex
Output:
--- Data stack:
NAN: 8000000000000
C{ NAN: 8000000000000 NAN: 8000000000000 }

Falcon

VBA/Python programmer's approach not sure if it's the most falconic way

/* created by Aykayayciti Earl Lamont Montgomery
April 9th, 2018 */

x = 0
y = 0
z = x**y
> "z=", z
Output:
z=1
[Finished in 0.2s]

Fermat

0^0
Output:
1

Forth

0e 0e f** f.
Output:
1.

Of course in an embedded program we would be tempted to "pre-calculate" the answer :-)

: ^0     DROP  1 ;
Output:
0 ^0 . 1 ok

Fortran

program zero
double precision :: i, j
double complex :: z1, z2
i = 0.0D0
j = 0.0D0
z1 = (0.0D0,0.0D0)
z2 = (0.0D0,0.0D0)
write(*,*) 'When integers are used, we have 0^0 = ', 0**0
write(*,*) 'When double precision numbers are used, we have 0.0^0.0 = ', i**j
write(*,*) 'When complex numbers are used, we have (0.0+0.0i)^(0.0+0.0i) = ', z1**z2
end program
Output:
 When integers are used, we have 0^0 =            1
 When double precision numbers are used, we have 0.0^0.0 =    1.0000000000000000     
 When complex numbers are used, we have (0.0+0.0i)^(0.0+0.0i) =  (             NaN,             NaN)

FreeBASIC

' FB 1.05.0 Win64

Print "0 ^ 0 ="; 0 ^ 0
Sleep
Output:
0 ^ 0 = 1

Frink

println[0^0]
Output:
1


FutureBasic

window 1

print 0^0

HandleEvents

Output:

1

Gambas

Click this link to run this code

Public Sub Main()

Print 0 ^ 0

End

Output:

1

GAP

0^0;
Output:
1

Go

Go does not have an exponentiation operator but has functions in the standard library for three types, float64, complex128, and big.Int. As of Go 1.3, all are documented to return 1.

package main

import (
    "fmt"
    "math"
    "math/big"
    "math/cmplx"
)

func main() {
    fmt.Println("float64:    ", math.Pow(0, 0))
    var b big.Int
    fmt.Println("big integer:", b.Exp(&b, &b, nil))
    fmt.Println("complex:    ", cmplx.Pow(0, 0))
}
Output:
float64:     1
big integer: 1
complex:     (1+0i)

Golfscript

0 0?
Output:
1

Groovy

Translation of: Java

Test:

println 0**0
Output:
1

GW-BASIC

PRINT 0^0
Output:
1

Haskell

import Data.Complex ( Complex((:+)) )

main :: IO ()
main = mapM_ print [
     0 ^ 0,
     0.0 ^ 0,
     0 ^^ 0,
     0 ** 0,
    (0 :+ 0) ^ 0,
    (0 :+ 0) ** (0 :+ 0)
  ]
Output:
1
1.0
1.0
1.0
1.0 :+ 0.0
1.0 :+ 0.0

HolyC

F64 a = 0 ` 0;
Print("0 ` 0 = %5.3f\n", a);
Output:
0 ` 0 = 1.000

Icon and Unicon

"Works" in both languages:

procedure main()
    write(0^0)
end
Output:
->z2z

Run-time error 204
File z2z.icn; Line 2
real overflow, underflow, or division by zero
Traceback:
   main()
   {0 ^ 0} from line 2 in z2z.icn
->

J

   0 ^ 0
1

Note also that this is the multiplicative identity (which means that it's consistent with 1*0 representing 0^1 and with 1*0*0 representing 0^2 and with 1*0*0*0 representing 0^3 and with 1*2*2*2 representing 2^3 and so on. Also, this is the result of finding the product of an empty list:

   */''
1

(In */'' 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.)

Java

System.out.println(Math.pow(0, 0));
Output:
1.0

JavaScript

Math.pow

Works with: Node.js

In interactive mode:

> Math.pow(0, 0);
1

exponentiation operator (**)

> 0**0
1

jq

Works with: jq version 1.5

Also works with gojq and fq

$ jq -n 'pow(0;0)'
1

It is also worth noting that in jq, gojq, and fq, `pow(0; infinite)` yields 0.

Jsish

puts(Math.pow(0,0));
Output:
1

Julia

Try all combinations of complex, float, rational, integer and boolean.

using Printf

const types = (Complex, Float64, Rational, Int, Bool)

for Tb in types, Te in types
    zb, ze = zero(Tb), zero(Te)
    r = zb ^ ze
    @printf("%10s ^ %-10s = %7s ^ %-7s = %-12s (%s)\n", Tb, Te, zb, ze, r, typeof(r))
end
Output:
   Complex ^ Complex    = 0 + 0im ^ 0 + 0im = 1.0 + 0.0im  (Complex{Float64})
   Complex ^ Float64    = 0 + 0im ^ 0.0     = 1.0 + 0.0im  (Complex{Float64})
   Complex ^ Rational   = 0 + 0im ^ 0//1    = 1.0 + 0.0im  (Complex{Float64})
   Complex ^ Int64      = 0 + 0im ^ 0       = 1 + 0im      (Complex{Int64})
   Complex ^ Bool       = 0 + 0im ^ false   = 1 + 0im      (Complex{Int64})
   Float64 ^ Complex    =     0.0 ^ 0 + 0im = 1.0 + 0.0im  (Complex{Float64})
   Float64 ^ Float64    =     0.0 ^ 0.0     = 1.0          (Float64)
   Float64 ^ Rational   =     0.0 ^ 0//1    = 1.0          (Float64)
   Float64 ^ Int64      =     0.0 ^ 0       = 1.0          (Float64)
   Float64 ^ Bool       =     0.0 ^ false   = 1.0          (Float64)
  Rational ^ Complex    =    0//1 ^ 0 + 0im = 1.0 + 0.0im  (Complex{Float64})
  Rational ^ Float64    =    0//1 ^ 0.0     = 1.0          (Float64)
  Rational ^ Rational   =    0//1 ^ 0//1    = 1.0          (Float64)
  Rational ^ Int64      =    0//1 ^ 0       = 1//1         (Rational{Int64})
  Rational ^ Bool       =    0//1 ^ false   = 1//1         (Rational{Int64})
     Int64 ^ Complex    =       0 ^ 0 + 0im = 1.0 + 0.0im  (Complex{Float64})
     Int64 ^ Float64    =       0 ^ 0.0     = 1.0          (Float64)
     Int64 ^ Rational   =       0 ^ 0//1    = 1.0          (Float64)
     Int64 ^ Int64      =       0 ^ 0       = 1            (Int64)
     Int64 ^ Bool       =       0 ^ false   = 1            (Int64)
      Bool ^ Complex    =   false ^ 0 + 0im = 1.0 + 0.0im  (Complex{Float64})
      Bool ^ Float64    =   false ^ 0.0     = 1.0          (Float64)
      Bool ^ Rational   =   false ^ 0//1    = 1.0          (Float64)
      Bool ^ Int64      =   false ^ 0       = true         (Bool)
      Bool ^ Bool       =   false ^ false   = true         (Bool)

K

  0^0
1.0

Klingphix

:mypower
    dup not (
      [ drop sign dup 0 equal [ drop 1 ] if ]
      [ power ]
    ) if
;
 
0 0 mypower print nl

"End " input
Output:
1
End

Kotlin

import kotlin.math.pow

fun main() {
   println(0.0.pow(0))
}
Output:
1.0

Lambdatalk

{pow 0 0}
-> 1
{exp 0 0}
-> 1

LDPL

data:
x is number

procedure:
raise 0 to 0 in x
display x lf
Output:
1

Liberty BASIC

'********
print 0^0
'********
Output:
1

Locomotive Basic

print 0🠅0
Output:
 1

Lua

No need to try different data types or with / without decimal points as all numbers in Lua are stored in double-precision floating-point format.

print(0^0)
Output:
1

M2000 Interpreter

M2000 use ** and ^ for power.

Module Checkit {
      x=0
      y=0
      Print x**y=1, x^y=1    ' True True
}
Checkit

Maple

0^0
Output:
1

However, for consistency with IEEE-754 numerics, we also have a NaN result for the equivalent floating-point exponentiation:

0^0.0
Output:
Float(undefined)

Mathematica/Wolfram Language

0^0
Output:
Indeterminate

MATLAB / Octave

0^0
complex(0,0)^0
Output:
1
1

Maxima

0^0;
Output:
                  0
expt: undefined: 0

Mercury

:- module zero_to_the_zero_power.
:- interface.

:- import_module io.

:- pred main(io::di, io::uo) is det.

:- implementation.

:- import_module float, int, integer, list, string.

main(!IO) :-
   io.format("    int.pow(0, 0) = %d\n", [i(pow(0, 0))], !IO),
   io.format("integer.pow(zero, zero) = %s\n",
        [s(to_string(pow(zero, zero)))], !IO),
   io.format("  float.pow(0.0, 0) = %.1f\n", [f(pow(0.0, 0))], !IO).

:- end_module zero_to_the_zero_power.
Output:
    int.pow(0, 0) = 1
integer.pow(zero, zero) = 1
  float.pow(0.0, 0) = 1.0

Microsoft Small Basic

TextWindow.WriteLine(Math.Power(0,0))
Output:
1

min

Works with: min version 0.19.3
0 0 pow puts
Output:
1.0

MiniScript

print "The result of zero to the zero power is " + 0^0
Output:
The result of zero to the zero power is 1

МК-61/52

Сx	^	x^y	С/П

The result is error message.

Nanoquery

println 0^0
Output:
1

Neko

Neko uses the C math library for exponentiation, Zero to the zero in math.pow(x, y) is treated as being 1.

/**
 Zero to the zeroth power, in Neko
*/

var math_pow = $loader.loadprim("std@math_pow", 2)

$print(math_pow(0, 0), "\n")
Output:
prompt$ nekoc zero-to-the-zero.neko
prompt$ neko zero-to-the-zero.n
1

NetRexx

x=0
Say '0**0='||x**x
Output:
0**0=1

NewLISP

(pow 0 0)
Output:
1

Nial

Create an exponentiation table for all type combinations (of integer 0, float 0.0 and boolean o):

     0 0.0 o outer power 0 0.0 o
+--+--+--+
| 1|1.| 1|
+--+--+--+
|1.|1.|1.|
+--+--+--+
| 1|1.| 1|
+--+--+--+

Nim

import math

echo pow(0.0, 0.0)  # Floating point exponentiation.
echo 0 ^ 0          # Integer exponentiation.
Output:
1.0
1

OCaml

In the interpreter:

# 0.0 ** 0.0;;
- : float = 1.
# Complex.pow Complex.zero Complex.zero;;
- : Complex.t = {Complex.re = nan; Complex.im = nan}
# #load "nums.cma";;
# open Num;;
# Int 0 **/ Int 0;;                 
- : Num.num = Int 1

Oforth

0 0 pow println
Output:
1

Ol

(print "0^0: " (expt 0 0))
(print "0.0^0: " (expt (inexact 0) 0))
Output:
0^0: 1
0.0^0: 1

ooRexx

/**********************************************************************
* 21.04.2014 Walter Pachl
**********************************************************************/
Say 'rxCalcpower(0,0)  ->' rxCalcpower(0,0)
Say '0**0              ->' 0**0
::requires rxmath library
Output:
rxCalcpower(0,0)  -> 1
0**0              -> 1 


Openscad

echo (0^0);


PARI/GP

0 raised to the power of exact 0 is 1, but 0 cannot be raised to the power of an inexact 0:

0^0
0.^0
0^0.
Output:
%1 = 1
%2 = 1
  ***   at top-level: 0^0.
  ***                   ^---
  *** _^_: domain error in gpow(0,n): n <= 0
  ***   Break loop: type 'break' to go back to GP prompt

Pascal

Works with: Free Pascal
Library: math
program ZToZ;
uses
  math;
begin
  write('0.0 ^ 0 :',IntPower(0.0,0):4:2);
  writeln('   0.0 ^ 0.0 :',Power(0.0,0.0):4:2);
end.
output
0.0 ^ 0 :1.00   0.0 ^ 0.0 :1.00

Perl

print 0 ** 0, "\n";

use Math::Complex;

print cplx(0,0) ** cplx(0,0), "\n";
Output:
1
1

Phix

Library: Phix/basics
?power(0,0)
requires("0.8.4") -- (now fixed/crashes on earlier versions)
include complex.e
complex a = complex_new(0,0),
        b = complex_power(a,a)
string sa = complex_sprint(a,true),
       sb = complex_sprint(b,true)
printf(1,"%s ^ %s = %s\n",{sa,sa,sb})
Output:
1
0+0i ^ 0+0i = 1+0i

Phixmonti

def mypower
    dup not if
        . sign dup 0 == if . 1 endif
    else
        power
    endif
enddef

0 0 mypower print
Output:
1

PHP

<?php
echo pow(0,0);
echo 0 ** 0; // PHP 5.6+ only
?>
Output:
1
1

PicoLisp

 
(** 0 0)
Output:

1

Pike

write( pow(0, 0) +"\n" );
Output:
1

PL/I

 zhz: Proc Options(Main);
 Dcl a dec float(10) Init(1);
 Dcl b dec float(10) Init(0);
 Put skip list('1**0=',a**b);
 Put skip list('0**1=',b**a);
 Put skip list('0**0=',b**b);
 End;
Output:
1**0=                    1.000000000E+0000
0**1=                    0.000000000E+0000
0**0=
IBM0682I  ONCODE=1553  X in EXPONENT(X) was invalid.
   At offset +0000025B in procedure with entry ZHZ   

Plain English

To run:
Start up.
Put 0 into a number.
Raise the number to 0.
Convert the number to a string.
Write the string to the console.
Wait for the escape key.
Shut down.
Output:
1

PowerShell

Write-Host "0 ^ 0 = " ([math]::pow(0,0))

Output :

0 ^ 0 =  1

PureBasic

If OpenConsole()
  PrintN("Zero to the zero power is " + Pow(0,0))
  PrintN("")
  PrintN("Press any key to close the console")
  Repeat: Delay(10) : Until Inkey() <> ""
  CloseConsole()
EndIf
Output:
Zero to the zero power is 1

Pyret

num-expt(0, 0)
Output:

1

Python

Python3

from decimal import Decimal
from fractions import Fraction
from itertools import product

zeroes = [0, 0.0, 0j, Decimal(0), Fraction(0, 1), -0.0, -0.0j, Decimal(-0.0)]
for i, j in product(zeroes, repeat=2):
    try:
        ans = i**j
    except:
        ans = '<Exception raised>'
    print(f'{i!r:>15} ** {j!r:<15} = {ans!r}')
Output:
              0 ** 0               = 1
              0 ** 0.0             = 1.0
              0 ** 0j              = (1+0j)
              0 ** Decimal('0')    = '<Exception raised>'
              0 ** Fraction(0, 1)  = 1
              0 ** -0.0            = 1.0
              0 ** (-0-0j)         = (1+0j)
              0 ** Decimal('-0')   = '<Exception raised>'
            0.0 ** 0               = 1.0
            0.0 ** 0.0             = 1.0
            0.0 ** 0j              = (1+0j)
            0.0 ** Decimal('0')    = '<Exception raised>'
            0.0 ** Fraction(0, 1)  = 1.0
            0.0 ** -0.0            = 1.0
            0.0 ** (-0-0j)         = (1+0j)
            0.0 ** Decimal('-0')   = '<Exception raised>'
             0j ** 0               = (1+0j)
             0j ** 0.0             = (1+0j)
             0j ** 0j              = (1+0j)
             0j ** Decimal('0')    = '<Exception raised>'
             0j ** Fraction(0, 1)  = (1+0j)
             0j ** -0.0            = (1+0j)
             0j ** (-0-0j)         = (1+0j)
             0j ** Decimal('-0')   = '<Exception raised>'
   Decimal('0') ** 0               = '<Exception raised>'
   Decimal('0') ** 0.0             = '<Exception raised>'
   Decimal('0') ** 0j              = '<Exception raised>'
   Decimal('0') ** Decimal('0')    = '<Exception raised>'
   Decimal('0') ** Fraction(0, 1)  = '<Exception raised>'
   Decimal('0') ** -0.0            = '<Exception raised>'
   Decimal('0') ** (-0-0j)         = '<Exception raised>'
   Decimal('0') ** Decimal('-0')   = '<Exception raised>'
 Fraction(0, 1) ** 0               = Fraction(1, 1)
 Fraction(0, 1) ** 0.0             = 1.0
 Fraction(0, 1) ** 0j              = (1+0j)
 Fraction(0, 1) ** Decimal('0')    = '<Exception raised>'
 Fraction(0, 1) ** Fraction(0, 1)  = Fraction(1, 1)
 Fraction(0, 1) ** -0.0            = 1.0
 Fraction(0, 1) ** (-0-0j)         = (1+0j)
 Fraction(0, 1) ** Decimal('-0')   = '<Exception raised>'
           -0.0 ** 0               = 1.0
           -0.0 ** 0.0             = 1.0
           -0.0 ** 0j              = (1+0j)
           -0.0 ** Decimal('0')    = '<Exception raised>'
           -0.0 ** Fraction(0, 1)  = 1.0
           -0.0 ** -0.0            = 1.0
           -0.0 ** (-0-0j)         = (1+0j)
           -0.0 ** Decimal('-0')   = '<Exception raised>'
        (-0-0j) ** 0               = (1+0j)
        (-0-0j) ** 0.0             = (1+0j)
        (-0-0j) ** 0j              = (1+0j)
        (-0-0j) ** Decimal('0')    = '<Exception raised>'
        (-0-0j) ** Fraction(0, 1)  = (1+0j)
        (-0-0j) ** -0.0            = (1+0j)
        (-0-0j) ** (-0-0j)         = (1+0j)
        (-0-0j) ** Decimal('-0')   = '<Exception raised>'
  Decimal('-0') ** 0               = '<Exception raised>'
  Decimal('-0') ** 0.0             = '<Exception raised>'
  Decimal('-0') ** 0j              = '<Exception raised>'
  Decimal('-0') ** Decimal('0')    = '<Exception raised>'
  Decimal('-0') ** Fraction(0, 1)  = '<Exception raised>'
  Decimal('-0') ** -0.0            = '<Exception raised>'
  Decimal('-0') ** (-0-0j)         = '<Exception raised>'
  Decimal('-0') ** Decimal('-0')   = '<Exception raised>'

Python2

from decimal import Decimal
from fractions import Fraction
for n in (Decimal(0), Fraction(0, 1), complex(0), float(0), int(0)):
	try:
		n1 = n**n
	except:
		n1 = '<Raised exception>'
	try:
		n2 = pow(n, n)
	except:
		n2 = '<Raised exception>'
	print('%8s: ** -> %r; pow -> %r' % (n.__class__.__name__, n1, n2))
Output:
 Decimal: ** -> '<Raised exception>'; pow -> '<Raised exception>'
Fraction: ** -> Fraction(1, 1); pow -> Fraction(1, 1)
 complex: ** -> (1+0j); pow -> (1+0j)
   float: ** -> 1.0; pow -> 1.0
     int: ** -> 1; pow -> 1

QB64

Print 0 ^ 0
Output:
1

Alternatively:

i% = 0 'Integer
l& = 0 'Long integer
s! = 0.0 'Single precision floating point
d# = 0.0 'Double precision floating point
b` = 0 '_Bit
bb%% = 0 '_Byte
isf&& = 0 '_Integer64

Print i% ^ i%
Print l& ^ l&
Print s! ^ s!
Print d# ^ d#
Print b` ^ b`
Print bb%% ^ bb%%
Print isf&& ^ isf&&
Output:

NB: Values with 0 decimals are trimmed by Print's casting from number value to String.

 1
 1
 1
 1
 1
 1
 1

Quackery

As a dialogue in the Quackery shell.

/O> 0 0 **
... 

Stack: 1

R

print(0^0)
Output:
1

Racket

#lang racket
;; as many zeros as I can think of...
(define zeros (list
               0  ; unspecified number type
               0. ; hinted as float
               #e0 ; explicitly exact
               #i0 ; explicitly inexact
               0+0i ; exact complex
               0.+0.i ; float inexact
               ))
(for*((z zeros) (p zeros))
  (printf "(~a)^(~a) = ~s~%" z p
  (with-handlers [(exn:fail:contract:divide-by-zero? exn-message)]
    (expt z p))))
Output:
(0)^(0) = 1
(0)^(0.0) = 1.0
(0)^(0) = 1
(0)^(0.0) = 1.0
(0)^(0) = 1
(0)^(0.0+0.0i) = "expt: undefined for 0 and 0.0+0.0i"
(0.0)^(0) = 1
(0.0)^(0.0) = 1.0
(0.0)^(0) = 1
(0.0)^(0.0) = 1.0
(0.0)^(0) = 1
(0.0)^(0.0+0.0i) = +nan.0+nan.0i
(0)^(0) = 1
(0)^(0.0) = 1.0
(0)^(0) = 1
(0)^(0.0) = 1.0
(0)^(0) = 1
(0)^(0.0+0.0i) = "expt: undefined for 0 and 0.0+0.0i"
(0.0)^(0) = 1
(0.0)^(0.0) = 1.0
(0.0)^(0) = 1
(0.0)^(0.0) = 1.0
(0.0)^(0) = 1
(0.0)^(0.0+0.0i) = +nan.0+nan.0i
(0)^(0) = 1
(0)^(0.0) = 1.0
(0)^(0) = 1
(0)^(0.0) = 1.0
(0)^(0) = 1
(0)^(0.0+0.0i) = "expt: undefined for 0 and 0.0+0.0i"
(0.0+0.0i)^(0) = 1
(0.0+0.0i)^(0.0) = 1.0+0.0i
(0.0+0.0i)^(0) = 1
(0.0+0.0i)^(0.0) = 1.0+0.0i
(0.0+0.0i)^(0) = 1
(0.0+0.0i)^(0.0+0.0i) = +nan.0+nan.0i

Raku

(formerly Perl 6)

Works with: Rakudo version 2018.03
say '    type         n      n**n  exp(n,n)';
say '--------  --------  --------  --------';

for 0, 0.0, FatRat.new(0), 0e0, 0+0i {
    printf "%8s  %8s  %8s  %8s\n", .^name, $_, $_**$_, exp($_,$_);
}
Output:
    type         n      n**n  exp(n,n)
--------  --------  --------  --------
     Int         0         1         1
     Rat         0         1         1
  FatRat         0         1         1
     Num         0         1         1
 Complex      0+0i      1+0i      1+0i

Red

Shown using the operator, the function, and the math mini-DSL that uses the order of operations from mathematics:

Red[]
print 0 ** 0
print power 0 0
print math [0 ** 0]
Output:
1
1
1

Relation

echo pow(0,0)
// 1

REXX

/*REXX program shows the results of  raising zero  to the  zeroth power.*/
say  '0 ** 0  (zero to the zeroth power) ───► '    0**0


using PC/REXX
using Personal REXX
using REGINA
using ooRexx

Output:
0 ** 0  (zero to the zeroth power) ───►  1

using R4

Output:
Error 26 : Invalid whole number (SYNTAX)
Information: 0 ** 0 is undefined
Error occurred in statement# 2
Statement source: say '0 ** 0  (zero to the zeroth power) ───► ' 0**0
Statement context: C:\ZERO_TO0.REX, procedure: ZERO_TO0

using ROO

Output:
Error 26 : Invalid whole number (SYNTAX)
Information: 0 ** 0 is undefined
Error occurred in statement# 2
Statement source: say '0 ** 0  (zero to the zeroth power) ───► ' 0**0
Statement context: C:\ZERO_TO0.REX, procedure: ZERO_TO0

Ring

x = 0
y = 0
z = pow(x,y)
see "z=" + z + nl   # z=1

RPL

0 0 ^

Output for HP-48G and older models

1: 1

Output for HP-49 and newer models

1: ?

Ruby

require 'bigdecimal'

[0, 0.0, Complex(0), Rational(0), BigDecimal("0")].each do |n|
  printf "%10s: ** -> %s\n" % [n.class, n**n]
end
Output:
   Integer: ** -> 1
     Float: ** -> 1.0
   Complex: ** -> 1+0i
  Rational: ** -> 1/1
BigDecimal: ** -> 0.1e1

Rust

fn main() {
    println!("{}",0u32.pow(0));
}
Output:
1

S-lang

print(0^0);
Output:
1.0

Scala

Library: Scala
  assert(math.pow(0, 0) == 1, "Scala blunder, should go back to school !")

Scheme

(display (expt 0 0)) (newline)
(display (expt 0.0 0.0)) (newline)
(display (expt 0+0i 0+0i)) (newline)
Output:
1
1.0
1.0

Seed7

$ include "seed7_05.s7i";
  include "float.s7i";
  include "complex.s7i";

const proc: main is func
  begin
    writeln("0      ** 0   = " <& 0 ** 0);
    writeln("0.0    ** 0   = " <& 0.0 ** 0);
    writeln("0.0    ** 0.0 = " <& 0.0 ** 0.0);
    writeln("0.0+0i ** 0   = " <& complex(0.0) ** 0);
  end func;
Output:
0      ** 0   = 1
0.0    ** 0   = 1.0
0.0    ** 0.0 = 1.0
0.0+0i ** 0   = 1.0+0.0i

SenseTalk

set a to 0
set b to 0

put a to the power of b
// Prints: 1

Sidef

[0, Complex(0, 0)].each {|n|
    say n**n
}
Output:
1
1

Taking the 0'th root of a number and raising it back to the zero power, we also get a 1:

say 0.root(0).pow(0)       # => 1
say ((0**(1/0))**0)        # => 1

Sinclair ZX81 BASIC

PRINT 0**0
Output:
1

Smalltalk

0 raisedTo: 0 
0.0 raisedTo: 0.0
Output:
1
1.0

smart BASIC

PRINT 0^0
Output:
1


SNOBOL4

	OUTPUT = (0 ** 0)
END


SQL

SQL> select power(0,0) from dual;
Output:
POWER(0,0)
----------
         1

Standard ML

In the interpreter:

- Math.pow (0.0, 0.0);
val it = 1.0 : real

Stata

. display 0^0
1

Swift

import Darwin
print(pow(0.0,0.0))
Output:
1.0

Symsyn

 (0^0) []
Output:
 1 

Tcl

Interactively…

% expr 0**0
1
% expr 0.0**0.0
1.0

TI SR-56

0 Yx 0 =
Output:
 1 

TI-83_BASIC

0^0
Output:
ERROR:DOMAIN

uBasic/4tH

Print 0^0
Output:
1

0 OK, 0:9

Ursa

Cygnus/X Ursa is written in Java, and as a result returns 1.0 when raising 0 to the 0.

> out (pow 0 0) endl console
1.0

VBA

Public Sub zero()
    x = 0
    y = 0
    z = 0 ^ 0
    Debug.Print "z ="; z
End Sub
Output:
z = 1

VBScript

WScript.Echo 0 ^ 0
Output:
1


Verilog

module main;
  initial begin
    $display("0 ^ 0 = ", 0**0);
    $finish ;
  end
endmodule
Output:
0 ^ 0 =           1


Visual Basic .NET

Module Program
    Sub Main()
        Console.Write(0^0)
    End Sub
End Module
Output:
1

V (Vlang)

// Zero to the zero power, in V
// Tectonics: v run zero-to-the-zero-power.v
module main
import math

// starts here
// V does not include an exponentiation operator, but uses a math module
pub fn main() {
    println(math.pow(0, 0))
}
Output:
prompt$ v run rosetta/zero-to-the-zero-power.v
1.

Wren

System.print(0.pow(0))
Output:
1

XLISP

XLISP 3.3, September 6, 2002 Copyright (c) 1984-2002, by David Betz
[1] (expt 0 0)

1
[2]

XPL0

RlOut(0, Pow(0., 0.))
Output:
    1.00000

Zig

const std = @import("std");

pub fn main() !void {
    const stdout = std.io.getStdOut().writer();
    try stdout.print("0^0 = {d:.8}\n", .{std.math.pow(f32, 0, 0)});
}
Output:
0^0 = 1.00000000

zkl

(0.0).pow(0)  //--> 1.0
var BN=Import("zklBigNum"); // big ints
BN(0).pow(0) //--> 1