Zero to the zero power: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
|||
Line 37: | Line 37: | ||
=={{header|11l}}== |
=={{header|11l}}== |
||
<lang |
<syntaxhighlight lang="11l">print(0 ^ 0)</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
Line 45: | Line 45: | ||
=={{header|8th}}== |
=={{header|8th}}== |
||
< |
<syntaxhighlight lang="forth"> |
||
0 0 ^ . |
0 0 ^ . |
||
</syntaxhighlight> |
|||
</lang> |
|||
{{out}} |
{{out}} |
||
1 |
1 |
||
Line 56: | Line 56: | ||
=={{header|Action!}}== |
=={{header|Action!}}== |
||
{{libheader|Action! Tool Kit}} |
{{libheader|Action! Tool Kit}} |
||
< |
<syntaxhighlight lang="action!">INCLUDE "D2:REAL.ACT" ;from the Action! Tool Kit |
||
PROC Main() |
PROC Main() |
||
Line 69: | Line 69: | ||
PrintR(z) Print("=") |
PrintR(z) Print("=") |
||
PrintRE(res) |
PrintRE(res) |
||
RETURN</ |
RETURN</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Zero_to_the_zero_power.png Screenshot from Atari 8-bit computer] |
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Zero_to_the_zero_power.png Screenshot from Atari 8-bit computer] |
||
Line 77: | Line 77: | ||
=={{header|Ada}}== |
=={{header|Ada}}== |
||
< |
<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 108: | 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 120: | 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}} |
||
< |
<syntaxhighlight lang="algol68">print( ( 0 ^ 0, newline ) ) |
||
</syntaxhighlight> |
|||
</lang> |
|||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
Line 128: | Line 128: | ||
=={{header|APL}}== |
=={{header|APL}}== |
||
< |
<syntaxhighlight lang="apl"> 0*0 |
||
1</ |
1</syntaxhighlight> |
||
=={{header|AppleScript}}== |
=={{header|AppleScript}}== |
||
<lang |
<syntaxhighlight lang="applescript"> return 0 ^ 0</syntaxhighlight> |
||
{{output}} |
{{output}} |
||
<lang |
<syntaxhighlight lang="applescript">1.0</syntaxhighlight> |
||
=={{header|Applesoft BASIC}}== |
=={{header|Applesoft BASIC}}== |
||
Line 145: | Line 145: | ||
=={{header|Arturo}}== |
=={{header|Arturo}}== |
||
< |
<syntaxhighlight lang="rebol">print 0 ^ 0 |
||
print 0.0 ^ 0</ |
print 0.0 ^ 0</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
Line 154: | Line 154: | ||
=={{header|Asymptote}}== |
=={{header|Asymptote}}== |
||
< |
<syntaxhighlight lang="asymptote">write("0 ^ 0 = ", 0 ** 0);</syntaxhighlight> |
||
=={{header|AutoHotkey}}== |
=={{header|AutoHotkey}}== |
||
<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 168: | Line 168: | ||
exit(0) |
exit(0) |
||
} |
} |
||
</syntaxhighlight> |
|||
</lang> |
|||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
Line 175: | Line 175: | ||
=={{header|BaCon}}== |
=={{header|BaCon}}== |
||
<lang |
<syntaxhighlight lang="freebasic">PRINT POW(0, 0)</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
Line 183: | Line 183: | ||
=={{header|BASIC}}== |
=={{header|BASIC}}== |
||
==={{header|BASIC256}}=== |
==={{header|BASIC256}}=== |
||
< |
<syntaxhighlight lang="basic256">print "0 ^ 0 = "; 0 ^ 0</syntaxhighlight> |
||
==={{header|QBasic}}=== |
==={{header|QBasic}}=== |
||
{{works with|QBasic|1.1}} |
{{works with|QBasic|1.1}} |
||
{{works with|QuickBasic|4.5}} |
{{works with|QuickBasic|4.5}} |
||
< |
<syntaxhighlight lang="qbasic">PRINT "0 ^ 0 ="; 0 ^ 0</syntaxhighlight> |
||
==={{header|True BASIC}}=== |
==={{header|True BASIC}}=== |
||
{{works with|QBasic}} |
{{works with|QBasic}} |
||
< |
<syntaxhighlight lang="qbasic">PRINT "0 ^ 0 ="; 0 ^ 0 |
||
END</ |
END</syntaxhighlight> |
||
=={{header|BBC BASIC}}== |
=={{header|BBC BASIC}}== |
||
< |
<syntaxhighlight lang="bbcbasic"> PRINT 0^0</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
Line 205: | Line 205: | ||
=={{header|Bc}}== |
=={{header|Bc}}== |
||
<syntaxhighlight lang="bc"> |
|||
<lang Bc> |
|||
0 ^ 0 |
0 ^ 0 |
||
</syntaxhighlight> |
|||
</lang> |
|||
{{out}} |
{{out}} |
||
1 |
1 |
||
Line 216: | Line 216: | ||
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). |
||
< |
<syntaxhighlight lang="befunge">"PDPF"4#@(0F0FYP)@</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
Line 223: | Line 223: | ||
=={{header|BQN}}== |
=={{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. |
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. |
||
<lang |
<syntaxhighlight lang="bqn">0⋆0</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre>1</pre> |
<pre>1</pre> |
||
=={{header|Bracmat}}== |
=={{header|Bracmat}}== |
||
<lang |
<syntaxhighlight lang="bracmat">0^0</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre>1</pre> |
<pre>1</pre> |
||
=={{header|Burlesque}}== |
=={{header|Burlesque}}== |
||
< |
<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 244: | Line 244: | ||
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. |
||
< |
<syntaxhighlight lang="c">#include <stdio.h> |
||
#include <math.h> |
#include <math.h> |
||
#include <complex.h> |
#include <complex.h> |
||
Line 254: | Line 254: | ||
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; |
||
}</ |
}</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
Line 263: | Line 263: | ||
=={{header|C sharp|C#}}== |
=={{header|C sharp|C#}}== |
||
< |
<syntaxhighlight lang="csharp">using System; |
||
namespace ZeroToTheZeroeth |
namespace ZeroToTheZeroeth |
||
Line 275: | Line 275: | ||
} |
} |
||
} |
} |
||
}</ |
}</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
Line 283: | Line 283: | ||
=={{header|C++}}== |
=={{header|C++}}== |
||
< |
<syntaxhighlight lang="cpp">#include <iostream> |
||
#include <cmath> |
#include <cmath> |
||
#include <complex> |
#include <complex> |
||
Line 293: | Line 293: | ||
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; |
||
}</ |
}</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
Line 302: | Line 302: | ||
=={{header|Caché ObjectScript}}== |
=={{header|Caché ObjectScript}}== |
||
< |
<syntaxhighlight lang="caché objectscript">ZEROPOW |
||
// default behavior is incorrect: |
// default behavior is incorrect: |
||
set (x,y) = 0 |
set (x,y) = 0 |
||
Line 311: | Line 311: | ||
w !,"0 to the 0th power (right): "_(x**y) |
w !,"0 to the 0th power (right): "_(x**y) |
||
quit</ |
quit</syntaxhighlight> |
||
{{out}}<pre>SAMPLES>do ^ZEROPOW |
{{out}}<pre>SAMPLES>do ^ZEROPOW |
||
Line 333: | Line 333: | ||
1 in my case could just be an implementation detail. |
1 in my case could just be an implementation detail. |
||
< |
<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 340: | Line 340: | ||
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</ |
end start_up</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre>integer 0**0: 1 |
<pre>integer 0**0: 1 |
||
Line 346: | Line 346: | ||
=={{header|COBOL}}== |
=={{header|COBOL}}== |
||
< |
<syntaxhighlight lang="cobol">identification division. |
||
program-id. zero-power-zero-program. |
program-id. zero-power-zero-program. |
||
data division. |
data division. |
||
Line 354: | Line 354: | ||
compute n = 0**0. |
compute n = 0**0. |
||
display n upon console. |
display n upon console. |
||
stop run.</ |
stop run.</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre>1</pre> |
<pre>1</pre> |
||
Line 360: | Line 360: | ||
=={{header|ColdFusion}}== |
=={{header|ColdFusion}}== |
||
=== Classic tag based CFML === |
=== Classic tag based CFML === |
||
< |
<syntaxhighlight lang="cfm"> |
||
<cfset zeroPowerTag = 0^0> |
<cfset zeroPowerTag = 0^0> |
||
<cfoutput>"#zeroPowerTag#"</cfoutput> |
<cfoutput>"#zeroPowerTag#"</cfoutput> |
||
</syntaxhighlight> |
|||
</lang> |
|||
{{Output}} |
{{Output}} |
||
<pre> |
<pre> |
||
Line 370: | Line 370: | ||
=== Script Based CFML === |
=== Script Based CFML === |
||
< |
<syntaxhighlight lang="cfm"><cfscript> |
||
zeroPower = 0^0; |
zeroPower = 0^0; |
||
writeOutput( zeroPower ); |
writeOutput( zeroPower ); |
||
</cfscript></ |
</cfscript></syntaxhighlight> |
||
{{Output}} |
{{Output}} |
||
<pre> |
<pre> |
||
Line 397: | Line 397: | ||
=={{header|Crystal}}== |
=={{header|Crystal}}== |
||
< |
<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}"</ |
puts "Negative Float32: #{-0_f32**-0_f32}"</syntaxhighlight> |
||
{{Output}} |
{{Output}} |
||
Line 409: | Line 409: | ||
=={{header|D}}== |
=={{header|D}}== |
||
< |
<syntaxhighlight lang="d">void main() { |
||
import std.stdio, std.math, std.bigint, std.complex; |
import std.stdio, std.math, std.bigint, std.complex; |
||
Line 420: | Line 420: | ||
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); |
||
}</ |
}</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre>Int: 1 |
<pre>Int: 1 |
||
Line 432: | Line 432: | ||
=={{header|Dc}}== |
=={{header|Dc}}== |
||
< |
<syntaxhighlight lang="dc">0 0^p |
||
</syntaxhighlight> |
|||
</lang> |
|||
{{Output}} |
{{Output}} |
||
<pre> |
<pre> |
||
Line 444: | Line 444: | ||
=={{header|EasyLang}}== |
=={{header|EasyLang}}== |
||
<lang>print pow 0 0</ |
<syntaxhighlight lang="text">print pow 0 0</syntaxhighlight> |
||
=={{header|EchoLisp}}== |
=={{header|EchoLisp}}== |
||
< |
<syntaxhighlight lang="scheme"> |
||
;; trying the 16 combinations |
;; trying the 16 combinations |
||
;; all return the integer 1 |
;; all return the integer 1 |
||
Line 455: | Line 455: | ||
(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 |
<syntaxhighlight lang="eiffel">print (0^0)</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre>1</pre> |
<pre>1</pre> |
||
Line 464: | Line 464: | ||
=={{header|Elena}}== |
=={{header|Elena}}== |
||
ELENA 4.x |
ELENA 4.x |
||
< |
<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) |
||
}</ |
}</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
Line 477: | Line 477: | ||
=={{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 |
<syntaxhighlight lang="lisp">(expt 0 0)</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
1 |
1 |
||
=={{header|ERRE}}== |
=={{header|ERRE}}== |
||
<syntaxhighlight lang="erre"> |
|||
<lang ERRE> |
|||
..... |
..... |
||
PRINT(0^0) |
PRINT(0^0) |
||
..... |
..... |
||
</syntaxhighlight> |
|||
</lang> |
|||
{{out}} |
{{out}} |
||
<pre> 1 |
<pre> 1 |
||
Line 505: | Line 505: | ||
=={{header|Factor}}== |
=={{header|Factor}}== |
||
< |
<syntaxhighlight lang="factor">USING: math.functions.private ; ! ^complex |
||
0 0 ^ |
0 0 ^ |
||
C{ 0 0 } C{ 0 0 } ^complex</ |
C{ 0 0 } C{ 0 0 } ^complex</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre>--- Data stack: |
<pre>--- Data stack: |
||
Line 515: | Line 515: | ||
=={{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''' |
||
< |
<syntaxhighlight lang="falcon"> |
||
/* created by Aykayayciti Earl Lamont Montgomery |
/* created by Aykayayciti Earl Lamont Montgomery |
||
April 9th, 2018 */ |
April 9th, 2018 */ |
||
Line 524: | Line 524: | ||
> "z=", z |
> "z=", z |
||
</syntaxhighlight> |
|||
</lang> |
|||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
Line 532: | Line 532: | ||
=={{header|Fermat}}== |
=={{header|Fermat}}== |
||
<lang |
<syntaxhighlight lang="fermat">0^0</syntaxhighlight> |
||
{{out}}<pre>1</pre> |
{{out}}<pre>1</pre> |
||
=={{header|Forth}}== |
=={{header|Forth}}== |
||
<lang |
<syntaxhighlight lang="forth">0e 0e f** f.</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
Line 543: | Line 543: | ||
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 :-) |
||
< |
<syntaxhighlight lang="forth">: ^0 DROP 1 ;</syntaxhighlight> |
||
{{Output}} |
{{Output}} |
||
Line 552: | Line 552: | ||
=={{header|Fortran}}== |
=={{header|Fortran}}== |
||
<syntaxhighlight lang="fortran"> |
|||
<lang Fortran> |
|||
program zero |
program zero |
||
double precision :: i, j |
double precision :: i, j |
||
Line 564: | Line 564: | ||
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 573: | Line 573: | ||
=={{header|FreeBASIC}}== |
=={{header|FreeBASIC}}== |
||
< |
<syntaxhighlight lang="freebasic">' FB 1.05.0 Win64 |
||
Print "0 ^ 0 ="; 0 ^ 0 |
Print "0 ^ 0 ="; 0 ^ 0 |
||
Sleep</ |
Sleep</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
Line 584: | Line 584: | ||
=={{header|Frink}}== |
=={{header|Frink}}== |
||
<lang |
<syntaxhighlight lang="frink">println[0^0]</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
Line 593: | Line 593: | ||
=={{header|FutureBasic}}== |
=={{header|FutureBasic}}== |
||
< |
<syntaxhighlight lang="futurebasic">window 1 |
||
print 0^0 |
print 0^0 |
||
HandleEvents</ |
HandleEvents</syntaxhighlight> |
||
Output: |
Output: |
||
<pre> |
<pre> |
||
Line 605: | Line 605: | ||
=={{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]''' |
||
< |
<syntaxhighlight lang="gambas">Public Sub Main() |
||
Print 0 ^ 0 |
Print 0 ^ 0 |
||
End</ |
End</syntaxhighlight> |
||
Output: |
Output: |
||
<pre> |
<pre> |
||
Line 616: | Line 616: | ||
=={{header|GAP}}== |
=={{header|GAP}}== |
||
<lang |
<syntaxhighlight lang="gap">0^0;</syntaxhighlight> |
||
{{out}}<pre>1</pre> |
{{out}}<pre>1</pre> |
||
Line 622: | Line 622: | ||
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. |
||
< |
<syntaxhighlight lang="go">package main |
||
import ( |
import ( |
||
Line 636: | Line 636: | ||
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)) |
||
}</ |
}</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
Line 647: | Line 647: | ||
{{trans|Java}} |
{{trans|Java}} |
||
Test: |
Test: |
||
<lang |
<syntaxhighlight lang="groovy">println 0**0</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre>1</pre> |
<pre>1</pre> |
||
=={{header|GW-BASIC}}== |
=={{header|GW-BASIC}}== |
||
<lang |
<syntaxhighlight lang="gwbasic">PRINT 0^0</syntaxhighlight> |
||
{{out}}<pre>1</pre> |
{{out}}<pre>1</pre> |
||
=={{header|Haskell}}== |
=={{header|Haskell}}== |
||
< |
<syntaxhighlight lang="haskell">import Data.Complex |
||
main = do |
main = do |
||
Line 664: | Line 664: | ||
print $ 0 ** 0 |
print $ 0 ** 0 |
||
print $ (0 :+ 0) ^ 0 |
print $ (0 :+ 0) ^ 0 |
||
print $ (0 :+ 0) ** (0 :+ 0)</ |
print $ (0 :+ 0) ** (0 :+ 0)</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
Line 676: | Line 676: | ||
=={{header|HolyC}}== |
=={{header|HolyC}}== |
||
< |
<syntaxhighlight lang="holyc">F64 a = 0 ` 0; |
||
Print("0 ` 0 = %5.3f\n", a);</ |
Print("0 ` 0 = %5.3f\n", a);</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
Line 687: | Line 687: | ||
"Works" in both languages: |
"Works" in both languages: |
||
< |
<syntaxhighlight lang="unicon">procedure main() |
||
write(0^0) |
write(0^0) |
||
end</ |
end</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
Line 705: | Line 705: | ||
=={{header|J}}== |
=={{header|J}}== |
||
< |
<syntaxhighlight lang="j"> 0 ^ 0 |
||
1</ |
1</syntaxhighlight> |
||
=={{header|Java}}== |
=={{header|Java}}== |
||
< |
<syntaxhighlight lang="java">System.out.println(Math.pow(0, 0));</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre>1.0</pre> |
<pre>1.0</pre> |
||
Line 717: | Line 717: | ||
{{Works with|Node.js}} |
{{Works with|Node.js}} |
||
In interactive mode: |
In interactive mode: |
||
< |
<syntaxhighlight lang="javascript">> Math.pow(0, 0); |
||
1</ |
1</syntaxhighlight> |
||
===exponentiation operator (**)=== |
===exponentiation operator (**)=== |
||
< |
<syntaxhighlight lang="javascript">> 0**0 |
||
1</ |
1</syntaxhighlight> |
||
=={{header|jq}}== |
=={{header|jq}}== |
||
Line 728: | Line 728: | ||
a definition that makes a special case of 0^0 should be considered, e.g. |
a definition that makes a special case of 0^0 should be considered, e.g. |
||
along the following lines: |
along the following lines: |
||
< |
<syntaxhighlight lang="jq">def power(y): y as $y | if $y == 0 then 1 elif . == 0 then 0 else log * $y | exp end;</syntaxhighlight> |
||
This definition will however be unsatisfactory for many purposes |
This definition will however be unsatisfactory for many purposes |
||
Line 734: | Line 734: | ||
=={{header|Jsish}}== |
=={{header|Jsish}}== |
||
< |
<syntaxhighlight lang="javascript">puts(Math.pow(0,0));</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre>1</pre> |
<pre>1</pre> |
||
Line 740: | Line 740: | ||
=={{header|Julia}}== |
=={{header|Julia}}== |
||
Try all combinations of complex, float, rational, integer and boolean. |
Try all combinations of complex, float, rational, integer and boolean. |
||
< |
<syntaxhighlight lang="julia">using Printf |
||
const types = (Complex, Float64, Rational, Int, Bool) |
const types = (Complex, Float64, Rational, Int, Bool) |
||
Line 748: | Line 748: | ||
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</ |
end</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
Line 778: | Line 778: | ||
=={{header|K}}== |
=={{header|K}}== |
||
<syntaxhighlight lang="k"> |
|||
<lang K> |
|||
0^0 |
0^0 |
||
1.0 |
1.0 |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|Klingphix}}== |
=={{header|Klingphix}}== |
||
< |
<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 793: | Line 793: | ||
0 0 mypower print nl |
0 0 mypower print nl |
||
"End " input</ |
"End " input</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre>1 |
<pre>1 |
||
Line 799: | Line 799: | ||
=={{header|Kotlin}}== |
=={{header|Kotlin}}== |
||
< |
<syntaxhighlight lang="scala">// version 1.0.6 |
||
fun main(args: Array<String>) { |
fun main(args: Array<String>) { |
||
println("0 ^ 0 = ${Math.pow(0.0, 0.0)}") |
println("0 ^ 0 = ${Math.pow(0.0, 0.0)}") |
||
}</ |
}</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
Line 811: | Line 811: | ||
=={{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|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 829: | Line 829: | ||
=={{header|Locomotive Basic}}== |
=={{header|Locomotive Basic}}== |
||
<lang |
<syntaxhighlight lang="locobasic">print 0🠅0</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre> 1</pre> |
<pre> 1</pre> |
||
Line 835: | Line 835: | ||
=={{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 |
<syntaxhighlight lang="lua">print(0^0)</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre>1</pre> |
<pre>1</pre> |
||
Line 841: | Line 841: | ||
=={{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 848: | Line 848: | ||
} |
} |
||
Checkit |
Checkit |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|Maple}}== |
=={{header|Maple}}== |
||
<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 |
<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 |
<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</ |
complex(0,0)^0</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre>1 |
<pre>1 |
||
1</pre> |
1</pre> |
||
=={{header|Maxima}}== |
=={{header|Maxima}}== |
||
<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}}== |
||
< |
<syntaxhighlight lang="mercury">:- module zero_to_the_zero_power. |
||
:- interface. |
:- interface. |
||
Line 894: | Line 894: | ||
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.</ |
:- end_module zero_to_the_zero_power.</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre> int.pow(0, 0) = 1 |
<pre> int.pow(0, 0) = 1 |
||
Line 901: | Line 901: | ||
=={{header|Microsoft Small Basic}}== |
=={{header|Microsoft Small Basic}}== |
||
< |
<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 |
<syntaxhighlight lang="min">0 0 pow puts</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
Line 913: | Line 913: | ||
=={{header|MiniScript}}== |
=={{header|MiniScript}}== |
||
< |
<syntaxhighlight lang="miniscript">print "The result of zero to the zero power is " + 0^0</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
Line 920: | Line 920: | ||
=={{header|МК-61/52}}== |
=={{header|МК-61/52}}== |
||
<lang>Сx ^ x^y С/П</ |
<syntaxhighlight lang="text">Сx ^ x^y С/П</syntaxhighlight> |
||
The result is error message. |
The result is error message. |
||
=={{header|Nanoquery}}== |
=={{header|Nanoquery}}== |
||
<lang |
<syntaxhighlight lang="nanoquery">println 0^0</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre>1</pre> |
<pre>1</pre> |
||
Line 932: | Line 932: | ||
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 938: | Line 938: | ||
var math_pow = $loader.loadprim("std@math_pow", 2) |
var math_pow = $loader.loadprim("std@math_pow", 2) |
||
$print(math_pow(0, 0), "\n")</ |
$print(math_pow(0, 0), "\n")</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
Line 946: | Line 946: | ||
=={{header|NetRexx}}== |
=={{header|NetRexx}}== |
||
< |
<syntaxhighlight lang="netrexx">x=0 |
||
Say '0**0='||x**x</ |
Say '0**0='||x**x</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre>0**0=1</pre> |
<pre>0**0=1</pre> |
||
=={{header|NewLISP}}== |
=={{header|NewLISP}}== |
||
<lang |
<syntaxhighlight lang="newlisp">(pow 0 0)</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre>1</pre> |
<pre>1</pre> |
||
Line 960: | Line 960: | ||
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>): |
||
< |
<syntaxhighlight lang="nial"> 0 0.0 o outer power 0 0.0 o |
||
+--+--+--+ |
+--+--+--+ |
||
| 1|1.| 1| |
| 1|1.| 1| |
||
Line 967: | Line 967: | ||
+--+--+--+ |
+--+--+--+ |
||
| 1|1.| 1| |
| 1|1.| 1| |
||
+--+--+--+</ |
+--+--+--+</syntaxhighlight> |
||
=={{header|Nim}}== |
=={{header|Nim}}== |
||
< |
<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.</ |
echo 0 ^ 0 # Integer exponentiation.</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre>1.0 |
<pre>1.0 |
||
Line 993: | Line 993: | ||
=={{header|Oforth}}== |
=={{header|Oforth}}== |
||
<lang |
<syntaxhighlight lang="oforth">0 0 pow println</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
Line 1,001: | Line 1,001: | ||
=={{header|Ol}}== |
=={{header|Ol}}== |
||
< |
<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 1,012: | Line 1,012: | ||
=={{header|ooRexx}}== |
=={{header|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</ |
::requires rxmath library</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
Line 1,026: | Line 1,026: | ||
=={{header|Openscad}}== |
=={{header|Openscad}}== |
||
<lang |
<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 0, but 0 cannot be raised to the power of an inexact 0: |
||
< |
<syntaxhighlight lang="parigp">0^0 |
||
0.^0 |
0.^0 |
||
0^0.</ |
0^0.</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre>%1 = 1 |
<pre>%1 = 1 |
||
Line 1,044: | Line 1,044: | ||
=={{header|Pascal}}== |
=={{header|Pascal}}== |
||
{{works with|Free Pascal}} {{Libheader|math}} |
{{works with|Free Pascal}} {{Libheader|math}} |
||
< |
<syntaxhighlight lang="pascal">program ZToZ; |
||
uses |
uses |
||
math; |
math; |
||
Line 1,050: | Line 1,050: | ||
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.</ |
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}}== |
||
< |
<syntaxhighlight lang="perl">print 0 ** 0, "\n"; |
||
use Math::Complex; |
use Math::Complex; |
||
print cplx(0,0) ** cplx(0,0), "\n";</ |
print cplx(0,0) ** cplx(0,0), "\n";</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
Line 1,068: | Line 1,068: | ||
=={{header|Phix}}== |
=={{header|Phix}}== |
||
{{libheader|Phix/basics}} |
{{libheader|Phix/basics}} |
||
<!--< |
<!--<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,077: | Line 1,077: | ||
<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> |
||
<!--</ |
<!--</syntaxhighlight>--> |
||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
Line 1,085: | Line 1,085: | ||
=={{header|Phixmonti}}== |
=={{header|Phixmonti}}== |
||
< |
<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,093: | Line 1,093: | ||
enddef |
enddef |
||
0 0 mypower print</ |
0 0 mypower print</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre>1</pre> |
<pre>1</pre> |
||
=={{header|PHP}}== |
=={{header|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 |
||
?></ |
?></syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
Line 1,109: | Line 1,109: | ||
=={{header|PicoLisp}}== |
=={{header|PicoLisp}}== |
||
<syntaxhighlight lang="picolisp"> |
|||
<lang PicoLisp> |
|||
(** 0 0) |
(** 0 0) |
||
</syntaxhighlight> |
|||
</lang> |
|||
{{out}} |
{{out}} |
||
1 |
1 |
||
=={{header|Pike}}== |
=={{header|Pike}}== |
||
< |
<syntaxhighlight lang="pike">write( pow(0, 0) +"\n" );</syntaxhighlight> |
||
{{Out}} |
{{Out}} |
||
<pre> |
<pre> |
||
Line 1,123: | Line 1,123: | ||
=={{header|PL/I}}== |
=={{header|PL/I}}== |
||
< |
<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,129: | Line 1,129: | ||
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;</ |
End;</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
Line 1,140: | Line 1,140: | ||
=={{header|Plain English}}== |
=={{header|Plain English}}== |
||
< |
<syntaxhighlight lang="plainenglish">To run: |
||
Start up. |
Start up. |
||
Put 0 into a number. |
Put 0 into a number. |
||
Line 1,147: | Line 1,147: | ||
Write the string to the console. |
Write the string to the console. |
||
Wait for the escape key. |
Wait for the escape key. |
||
Shut down.</ |
Shut down.</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
Line 1,155: | Line 1,155: | ||
=={{header|PowerShell}}== |
=={{header|PowerShell}}== |
||
< |
<syntaxhighlight lang="powershell">Write-Host "0 ^ 0 = " ([math]::pow(0,0))</syntaxhighlight> |
||
Output : |
Output : |
||
Line 1,164: | Line 1,164: | ||
=={{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,172: | Line 1,172: | ||
CloseConsole() |
CloseConsole() |
||
EndIf |
EndIf |
||
</syntaxhighlight> |
|||
</lang> |
|||
{{out}} |
{{out}} |
||
Line 1,180: | Line 1,180: | ||
=={{header|Pyret}}== |
=={{header|Pyret}}== |
||
<lang |
<syntaxhighlight lang="pyret">num-expt(0, 0)</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
1 |
1 |
||
Line 1,186: | Line 1,186: | ||
=={{header|Python}}== |
=={{header|Python}}== |
||
===Python3=== |
===Python3=== |
||
< |
<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,196: | Line 1,196: | ||
except: |
except: |
||
ans = '<Exception raised>' |
ans = '<Exception raised>' |
||
print(f'{i!r:>15} ** {j!r:<15} = {ans!r}')</ |
print(f'{i!r:>15} ** {j!r:<15} = {ans!r}')</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre> 0 ** 0 = 1 |
<pre> 0 ** 0 = 1 |
||
Line 1,264: | Line 1,264: | ||
===Python2=== |
===Python2=== |
||
< |
<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,275: | Line 1,275: | ||
except: |
except: |
||
n2 = '<Raised exception>' |
n2 = '<Raised exception>' |
||
print('%8s: ** -> %r; pow -> %r' % (n.__class__.__name__, n1, n2))</ |
print('%8s: ** -> %r; pow -> %r' % (n.__class__.__name__, n1, n2))</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
Line 1,286: | Line 1,286: | ||
=={{header|QB64}}== |
=={{header|QB64}}== |
||
<lang |
<syntaxhighlight lang="qb64">Print 0 ^ 0</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre>1</pre> |
<pre>1</pre> |
||
Alternatively: |
Alternatively: |
||
< |
<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,304: | Line 1,304: | ||
Print b` ^ b` |
Print b` ^ b` |
||
Print bb%% ^ bb%% |
Print bb%% ^ bb%% |
||
Print isf&& ^ isf&&</ |
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,318: | Line 1,318: | ||
As a dialogue in the Quackery shell. |
As a dialogue in the Quackery shell. |
||
< |
<syntaxhighlight lang="quackery">/O> 0 0 ** |
||
... |
... |
||
Stack: 1 |
Stack: 1 |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|R}}== |
=={{header|R}}== |
||
<lang |
<syntaxhighlight lang="rsplus">print(0^0)</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre>1</pre> |
<pre>1</pre> |
||
Line 1,331: | Line 1,331: | ||
=={{header|Racket}}== |
=={{header|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,344: | Line 1,344: | ||
(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))))</ |
(expt z p))))</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
Line 1,388: | Line 1,388: | ||
{{works with|Rakudo|2018.03}} |
{{works with|Rakudo|2018.03}} |
||
<lang |
<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($_,$_); |
||
}</ |
}</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
Line 1,408: | Line 1,408: | ||
=={{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: |
||
< |
<syntaxhighlight lang="rebol">Red[] |
||
print 0 ** 0 |
print 0 ** 0 |
||
print power 0 0 |
print power 0 0 |
||
print math [0 ** 0]</ |
print math [0 ** 0]</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
Line 1,420: | Line 1,420: | ||
=={{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}}== |
||
< |
<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</ |
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,458: | Line 1,458: | ||
=={{header|Ring}}== |
=={{header|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|Ruby}}== |
=={{header|Ruby}}== |
||
< |
<syntaxhighlight lang="ruby">require 'bigdecimal' |
||
[0, 0.0, Complex(0), Rational(0), BigDecimal("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</ |
end</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
Line 1,481: | Line 1,481: | ||
=={{header|Rust}}== |
=={{header|Rust}}== |
||
< |
<syntaxhighlight lang="rust">fn main() { |
||
println!("{}",0u32.pow(0)); |
println!("{}",0u32.pow(0)); |
||
}</ |
}</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
Line 1,489: | Line 1,489: | ||
=={{header|S-lang}}== |
=={{header|S-lang}}== |
||
<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}}< |
{{libheader|Scala}}<syntaxhighlight lang="scala"> assert(math.pow(0, 0) == 1, "Scala blunder, should go back to school !")</syntaxhighlight> |
||
=={{header|Scheme}}== |
=={{header|Scheme}}== |
||
< |
<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)</ |
(display (expt 0+0i 0+0i)) (newline)</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre>1 |
<pre>1 |
||
Line 1,506: | Line 1,506: | ||
=={{header|Seed7}}== |
=={{header|Seed7}}== |
||
< |
<syntaxhighlight lang="seed7">$ include "seed7_05.s7i"; |
||
include "float.s7i"; |
include "float.s7i"; |
||
include "complex.s7i"; |
include "complex.s7i"; |
||
Line 1,517: | Line 1,517: | ||
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,528: | Line 1,528: | ||
=={{header|SenseTalk}}== |
=={{header|SenseTalk}}== |
||
< |
<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</ |
// Prints: 1</syntaxhighlight> |
||
=={{header|Sidef}}== |
=={{header|Sidef}}== |
||
< |
<syntaxhighlight lang="ruby">[0, Complex(0, 0)].each {|n| |
||
say n**n |
say n**n |
||
}</ |
}</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
Line 1,546: | Line 1,546: | ||
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: |
||
< |
<syntaxhighlight lang="ruby">say 0.root(0).pow(0) # => 1 |
||
say ((0**(1/0))**0) # => 1</ |
say ((0**(1/0))**0) # => 1</syntaxhighlight> |
||
=={{header|Sinclair ZX81 BASIC}}== |
=={{header|Sinclair ZX81 BASIC}}== |
||
<lang |
<syntaxhighlight lang="basic">PRINT 0**0</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre>1</pre> |
<pre>1</pre> |
||
Line 1,556: | Line 1,556: | ||
=={{header|Smalltalk}}== |
=={{header|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,567: | Line 1,567: | ||
=={{header|smart BASIC}}== |
=={{header|smart BASIC}}== |
||
<lang |
<syntaxhighlight lang="qbasic">PRINT 0^0</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
Line 1,576: | Line 1,576: | ||
=={{header|SNOBOL4}}== |
=={{header|SNOBOL4}}== |
||
< |
<syntaxhighlight lang="snobol4"> OUTPUT = (0 ** 0) |
||
END</ |
END</syntaxhighlight> |
||
=={{header|SQL}}== |
=={{header|SQL}}== |
||
<syntaxhighlight lang="sql"> |
|||
<lang SQL> |
|||
SQL> select power(0,0) from dual; |
SQL> select power(0,0) from dual; |
||
</syntaxhighlight> |
|||
</lang> |
|||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
Line 1,599: | Line 1,599: | ||
=={{header|Stata}}== |
=={{header|Stata}}== |
||
< |
<syntaxhighlight lang="stata">. display 0^0 |
||
1</ |
1</syntaxhighlight> |
||
=={{header|Swift}}== |
=={{header|Swift}}== |
||
< |
<syntaxhighlight lang="swift">import Darwin |
||
print(pow(0.0,0.0))</ |
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,617: | Line 1,617: | ||
=={{header|Tcl}}== |
=={{header|Tcl}}== |
||
Interactively… |
Interactively… |
||
< |
<syntaxhighlight lang="tcl">% expr 0**0 |
||
1 |
1 |
||
% expr 0.0**0.0 |
% expr 0.0**0.0 |
||
1.0</ |
1.0</syntaxhighlight> |
||
=={{header|TI-83_BASIC}}== |
=={{header|TI-83_BASIC}}== |
||
<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</ |
<syntaxhighlight lang="text">Print 0^0</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre>1 |
<pre>1 |
||
Line 1,636: | Line 1,636: | ||
=={{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. |
||
< |
<syntaxhighlight lang="ursa">> out (pow 0 0) endl console |
||
1.0</ |
1.0</syntaxhighlight> |
||
=={{header|VBA}}== |
=={{header|VBA}}== |
||
< |
<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</ |
End Sub</syntaxhighlight>{{out}} |
||
<pre>z = 1</pre> |
<pre>z = 1</pre> |
||
=={{header|VBScript}}== |
=={{header|VBScript}}== |
||
<lang |
<syntaxhighlight lang="vb">WScript.Echo 0 ^ 0</syntaxhighlight> |
||
{{Out}} |
{{Out}} |
||
<pre>1</pre> |
<pre>1</pre> |
||
Line 1,655: | Line 1,655: | ||
=={{header|Verilog}}== |
=={{header|Verilog}}== |
||
< |
<syntaxhighlight lang="verilog">module main; |
||
initial begin |
initial begin |
||
$display("0 ^ 0 = ", 0**0); |
$display("0 ^ 0 = ", 0**0); |
||
$finish ; |
$finish ; |
||
end |
end |
||
endmodule</ |
endmodule</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre>0 ^ 0 = 1</pre> |
<pre>0 ^ 0 = 1</pre> |
||
Line 1,666: | Line 1,666: | ||
=={{header|Visual Basic .NET}}== |
=={{header|Visual Basic .NET}}== |
||
< |
<syntaxhighlight lang="vbnet">Module Program |
||
Sub Main() |
Sub Main() |
||
Console.Write(0^0) |
Console.Write(0^0) |
||
End Sub |
End Sub |
||
End Module</ |
End Module</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
Line 1,676: | Line 1,676: | ||
=={{header|Vlang}}== |
=={{header|Vlang}}== |
||
< |
<syntaxhighlight lang="go">// Zero to the zero power, in V |
||
// Tectonics: v run zero-to-the-zero-power.v |
// Tectonics: v run zero-to-the-zero-power.v |
||
module main |
module main |
||
Line 1,685: | Line 1,685: | ||
pub fn main() { |
pub fn main() { |
||
println(math.pow(0, 0)) |
println(math.pow(0, 0)) |
||
}</ |
}</syntaxhighlight> |
||
{{out}}<pre>prompt$ v run rosetta/zero-to-the-zero-power.v |
{{out}}<pre>prompt$ v run rosetta/zero-to-the-zero-power.v |
||
1.</pre> |
1.</pre> |
||
=={{header|Wren}}== |
=={{header|Wren}}== |
||
< |
<syntaxhighlight lang="ecmascript">System.print(0.pow(0))</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
Line 1,698: | Line 1,698: | ||
=={{header|XLISP}}== |
=={{header|XLISP}}== |
||
< |
<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] </ |
[2] </syntaxhighlight> |
||
=={{header|XPL0}}== |
=={{header|XPL0}}== |
||
< |
<syntaxhighlight lang="xpl0">RlOut(0, Pow(0., 0.))</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre> 1.00000</pre> |
<pre> 1.00000</pre> |
||
=={{header|Zig}}== |
=={{header|Zig}}== |
||
< |
<syntaxhighlight lang="zig">const std = @import("std"); |
||
pub fn main() !void { |
pub fn main() !void { |
||
const stdout = std.io.getStdOut().writer(); |
const stdout = std.io.getStdOut().writer(); |
||
try stdout.print("0^0 = {d:.8}\n", .{std.math.pow(f32, 0, 0)}); |
try stdout.print("0^0 = {d:.8}\n", .{std.math.pow(f32, 0, 0)}); |
||
}</ |
}</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre>0^0 = 1.00000000</pre> |
<pre>0^0 = 1.00000000</pre> |
||
=={{header|zkl}}== |
=={{header|zkl}}== |
||
< |
<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</ |
BN(0).pow(0) //--> 1</syntaxhighlight> |