���ˤʤä�Ĵ�٤Ƥߤޤ�����

www.textfile.org - 0��0�� ��ͳ
Radium Software Development
"a0 = 1" ������䤹��� 1 �Τ褦�˻פ��뤬�� "0n = 0" ������䤹��� 0 �Τ褦�ˤ�פ��Ƥ��롣���������Ϥɤ����������

Javascript

Math.pow( , )

Perl

% perl -le 'print 0**0'
1

ʣ�ǿ��ˤ��Ƥ����ܡ�

#!/usr/bin/env perl -l
use strict;
use Math::Complex;
my $z0 = cplx(0,0);
print "$z0 ** $z0 == ", $z0**$z0;
%perl cpow.pl
0 ** 0 == 1

Ruby

% ruby -e 'p 0**0'
1
#!/usr/bin/env ruby
include Math
require 'complex'
z0 = Complex(0,0);
p z0**z0
puts z0**z0
% ruby cpow.rb
Complex(1, 0)
1+0i

Python

% python -c 'print 0**0'
1

C

��̩�ˤ�libm��C++�Ͼ�ά��

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(int argc, char **argv){ 
    double x = argc > 1 ? atof(argv[1]) : 0.0;
    double y = argc > 2 ? atof(argv[2]) : 0.0;
    return printf("pow(%f, %f) == %f\n",x, y, pow(x,y)); 
}
% gcc -Wall -W -lm -o pow pow.c
% ./pow 
pow(0.000000, 0.000000) == 1.000000

scheme

������gauche

% gosh
gosh> (expt 0 0)
1

Haskell

% ghci
   ___         ___ _
  / _ \ /\  /\/ __(_)
 / /_\// /_/ / /  | |      GHC Interactive, version 6.6, for Haskell 98.
/ /_\\/ __  / /___| |      http://www.haskell.org/ghc/
\____/\/ /_/\____/|_|      Type :? for help.

Loading package base ... linking ... done.
Prelude> 0^0
1
Prelude> 0**0
1.0

bc

% bc
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'. 
0^0
1

�����ʤäƤ���ȡ��߾�򥵥ݡ��Ȥ��Ƥ��Ƥ���0**0!=1�ʸ��줬¸�ߤ��ʤ����ȤƤⵤ�ˤʤ롣������󤽤��������饹��ץ��ȥ����פǼ�������ΤϤ����Ƥ��θ���Ǥϴ�ñ�ˤǤ���ΤǤϤ���Τ����ɡ�

Dan the Nullingual Powered by Null

�ɵ�:

Radium Software Development
�㤨�� C99 (ISO/IEC 9899;1999) �� math.h �˴ޤޤ�� pow �ؿ��ϡ���Ȼؿ���ξ���� 0 ��Ϳ����줿��硤�ɥᥤ�󥨥顼���֤����������Ƥ��� [C99] ��

���졢�֥ɥᥤ�󥨥顼���֤����⤢���פǤ��͡���ʸ�ϰʲ��ΤȤ��ꡣ

p.229
The pow functions compute x raised to the powery. A domain error occurs if x is finite and negative and y is finite and not an integer value. A range error may occur. A domain error may occur if x is zero and y is zero. A domain error or range error may occur if x is zero andyis less than zero.

�ǡ�GCC�ǤϤ���ʴ����Ǥ���

man pow (On OS X, gcc 4.01)
     pow(x, +-0) returns 1 for any x, even a NaN.
man pow (On FreeBSD 6-Stable, gcc 3.4.4)
     The function pow(x, 0) returns x**0 = 1 for all x including x = 0, infin-
     ity, and NaN .  Previous implementations of pow may have defined x**0 to
     be undefined in some or all of these cases.  Here are reasons for return-
     ing x**0 = 1 always:

     1.      Any program that already tests whether x is zero (or infinite or
             NaN) before computing x**0 cannot care whether 0**0 = 1 or not.
             Any program that depends upon 0**0 to be invalid is dubious any-
             way since that expression's meaning and, if invalid, its conse-
             quences vary from one computer system to another.

     2.      Some Algebra texts (e.g. Sigler's) define x**0 = 1 for all x,
             including x = 0.  This is compatible with the convention that
             accepts a[0] as the value of polynomial

                   p(x) = a[0]*x**0 + a[1]*x**1 + a[2]*x**2 +...+ a[n]*x**n

             at x = 0 rather than reject a[0]*0**0 as invalid.

     3.      Analysts will accept 0**0 = 1 despite that x**y can approach any-
             thing or nothing as x and y approach 0 independently.  The reason
             for setting 0**0 = 1 anyway is this:

                   If x(z) and y(z) are any functions analytic (expandable in
                   power series) in z around z = 0, and if there x(0) = y(0) =
                   0, then x(z)**y(z) -> 1 as z -> 0.

     4.      If 0**0 = 1, then infinity**0 = 1/0**0 = 1 too; and then NaN**0 =
             1 too because x**0 = 1 for all finite and infinite x, i.e., inde-
             pendently of x.