0**-1 == 0?

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

r14005 e$B$Ge(B

14005 ko1 assert_equal(0**-1 == 0, false)

e$B$H$$$&%F%9%H$,2C$($i$l$F$$$^$9$,!"e(B0**-1e$B$C$FK\Ev$K%<%m$J$s$G$7$ge(B
e$B$&$+!)e(B e$B<j85$N=hM}7O$Ge(B0e$B$K$J$k$b$N$O$J$$$h$&$G$9$,!#e(B

Perl: Inf
Python: ZeroDivisionError: 0.0 cannot be raised to a negative power
Gauche: +inf.0

違います。
0è² ã®æ•°ã¯æœªå®šç¾©ã§ã™ã€‚
0
0のほうが難しいです。微分積分学か解析学の分野に未定義です。他の数学の分野に1になります。とにかく他のプログラミングの言語にも0**0は1になるから大丈夫でしょうね。

2008/4/30 Yukihiro M. [email protected]:

[email protected]$G$9!#e(B

Yukihiro M. wrote:

14005 ko1 assert_equal(0**-1 == 0, false)

e$B$H$$$&%F%9%H$,2C$($i$l$F$$$^$9$,!"e(B0**-1e$B$C$FK\Ev$K%<%m$J$s$G$7$ge(B
e$B$&$+!)e(B e$B<j85$N=hM}7O$Ge(B0e$B$K$J$k$b$N$O$J$$$h$&$G$9$,!#e(B

e$B!!e(B0 ** -1 == 0 e$B$Oe(B falsee$B!"$H$$$&%F%9%H$N$h$&$G$9!#:#e(B
1.9 e$B$G;n$7$?$ie(B

./ruby -ve ‘p 0**-1’
ruby 1.9.0 (2008-04-27 revision 0) [i686-linux]
Rational(1, 0)

e$B$H$J$j$^$7$?!#e(BRational [email protected]$C$?!#e(B

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:34543] Re: 0**-1 == 0 ?”
on Wed, 30 Apr 2008 21:26:05 +0900, SASADA Koichi [email protected]
writes:

|Yukihiro M. wrote:
|> 14005 ko1 assert_equal(0**-1 == 0, false)
|>
|> e$B$H$$$&%F%9%H$,2C$($i$l$F$$$^$9$,!“e(B0**-1e$B$C$FK\Ev$K%<%m$J$s$G$7$ge(B
|> e$B$&$+!)e(B e$B<j85$N=hM}7O$Ge(B0e$B$K$J$k$b$N$O$J$$$h$&$G$9$,!#e(B
|
|e$B!!e(B0 ** -1 == 0 e$B$Oe(B falsee$B!”$H$$$&%F%9%H$N$h$&$G$9!#:#e(B 1.9 e$B$G;n$7$?$ie(B
|
|./ruby -ve ‘p 0**-1’
|ruby 1.9.0 (2008-04-27 revision 0) [i686-linux]
|Rational(1, 0)
|
|e$B$H$J$j$^$7$?!#e(BRational [email protected]$C$?!#e(B

e$B$$$:$l$K$7$F$b!“e(B0 ** -1
e$B$,!Ve(B0e$B$G$J$$CM$r;}$D!W$O<[email protected]$G$O$J$$e(B
e$B$N$G%F%9%H$+$i:o$j$^$;$s$+!)e(B
e$B$”$k$$$O!Ve(BRubye$B$G$O$I$&$"$k$Y$-e(B
[email protected]$7$F%F%9%H$r=q$-49$($k$+!#e(B

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:34545] Re: 0**-1 == 0 ?”
on Wed, 30 Apr 2008 23:02:24 +0900, Tanaka A. [email protected]
writes:

|> e$B$$$:$l$K$7$F$b!“e(B0 ** -1 e$B$,!Ve(B0e$B$G$J$$CM$r;}$D!W$O<[email protected]$G$O$J$$e(B
|> e$B$N$G%F%9%H$+$i:o$j$^$;$s$+!)e(B e$B$”$k$$$O!Ve(BRubye$B$G$O$I$&$"$k$Y$-e(B
|> [email protected]$7$F%F%9%H$r=q$-49$($k$+!#e(B
|
|e$B!VCM$r;}$C$?>l9g$=$l$Oe(B 0 e$B$G$J$$!W$N$O$?$7$+$G!“e(B0 e$B$NN_>h$Oe(B 0
|e$B$H$$$&@-<A$r;H$C$?:GE,2=$r;W$$IU$/$H$$$&$3$H$O=<J,$K$”$j$($F!“e(B
|e$B<B:]$K2a5n$K$”$C$?$N$G!"%F%9%H$r>C$9$N$ONI$/$J$$$H;W$$$^$9!#e(B

e$B$&!<$s!"$8$c$"!"J8;zDL$j!VCM$r;}$C$?>l9g$=$l$Oe(B 0
e$B$G$J$$!W$H$$e(B
e$B$&%F%9%H$K=q$-49$($k$3$H$rDs0F$7$^$9!#:#$N%F%9%H%U%l!<%`%o!<e(B
e$B%/$G$I$&=q$/$N$+$o$+$j$^$;$s$,!#e(B

                            e$B$^$D$b$He(B e$B$f$-$R$me(B /:|)

xe$B"e(B+0 e$B$N$H$-e(B 1/xe$B"e(B+e$B!ge(B e$B$J$N$G!"e(B
2
-1 == 0.5 e$B$J$i$Pe(B 0**-1 == 1.0/0.0 e$B$O8uJd$G$7$g$&$M!#e(B
[email protected]$7L58BBg$rI=8=$9$kJ}K!$,8=>u$G$Oe(B
Floate$B0J30$KB8:_$7$J$$$N$O5$$,$+$j$G$9!#e(B

e$B;d$N5-21$,3N$+$J$ie(B
mathematicae$B$de(Bmaximae$B$ODj?t$H$7$FL58BBg$r;}$C$F$$$F!“e(B
0**-1e$B$Oe(B0/1e$B$HF1$8L58BBg$K4JLs$5$l$^$9!#e(B
[email protected][email protected]:EY$,$”$k$N$+$OCN$j$^$;$s!#e(B

e$B$4$H$1$se(B

In article
[email protected],
“GOTO Kentaro” [email protected] writes:

xe$B"e(B+0 e$B$N$H$-e(B 1/xe$B"e(B+e$B!ge(B e$B$J$N$G!"e(B
2
-1 == 0.5 e$B$J$i$Pe(B 0**-1 == 1.0/0.0 e$B$O8uJd$G$7$g$&$M!#e(B

e$B$=$l$C$Fe(B rational e$B$,F~$C$F$J$$$H$-$N5sF0$G$9$h$M!#e(B

% ruby-1.8 -e ‘p 0**-1’
Infinity

[email protected]$7L58BBg$rI=8=$9$kJ}K!$,8=>u$G$Oe(B
Floate$B0J30$KB8:_$7$J$$$N$O5$$,$+$j$G$9!#e(B

rational e$B$,F~$k$He(B Rational(1, 0) e$B$K$J$C$F$$$?$N$O$=$&$$$&5$e(B
e$B$,$+$j$,$"$C$?$+$i$N$h$&$G$9!#e(B[ruby-dev:20907]

% ruby-1.8 -rrational -e ‘p 0**-1’
Rational(1, 0)

e$B7o$N%F%9%H$O$3$NCJ3,$^$G$r9MN8$7$F$$$?$N$Ge(B 0 e$B$H0[$J$k$H$$$&e(B
e$B>[email protected]$C$?$o$1$G$9!#e(B

e$B$H$3$m$,!"e(B[ruby-dev:34524] e$B$NBP=h$Ge(B 0**-1 e$B$,e(B
ZeroDivisionError e$B$K$J$j$^$7$?!#e(B

% ./ruby -ve ‘p 0**-1’
ruby 1.9.0 (2008-04-30 revision 16239) [i686-linux]
-e:1:in **': devided by zero (ZeroDivisionError) from -e:1:in**’
from -e:1:in `’

e$B$=$l$K$h$j7o$N%F%9%H$,%(%i!<$K$J$C$F!"$3$NOCBj$,=P$F$-$?$o$1e(B
e$B$G$9$,!";d$O$$$5$.$h$$A*[email protected]$H46$8$^$7$?!#e(B

In article [email protected],
Yukihiro M. [email protected] writes:

e$B$$$:$l$K$7$F$b!“e(B0 ** -1 e$B$,!Ve(B0e$B$G$J$$CM$r;}$D!W$O<[email protected]$G$O$J$$e(B
e$B$N$G%F%9%H$+$i:o$j$^$;$s$+!)e(B e$B$”$k$$$O!Ve(BRubye$B$G$O$I$&$"$k$Y$-e(B
[email protected]$7$F%F%9%H$r=q$-49$($k$+!#e(B

e$B!VCM$r;}$C$?>l9g$=$l$Oe(B 0 e$B$G$J$$!W$N$O$?$7$+$G!“e(B0
e$B$NN_>h$Oe(B 0
e$B$H$$$&@-<A$r;H$C$?:GE,2=$r;W$$IU$/$H$$$&$3$H$O=<J,$K$”$j$($F!“e(B
e$B<B:]$K2a5n$K$”$C$?$N$G!"%F%9%H$r>C$9$N$ONI$/$J$$$H;W$$$^$9!#e(B

0 e$B$NN_>h$Oe(B 0 e$B$H$$$&:GE,2=$r;W$$IU$$$?;~!“Ii$N?t$KBP$9$k5sF0e(B
e$B$r;W$$=P$7$F:GE,2=$r;W$$$H$I$^$k<+?.$O$”$j$^$9$+e(B?

e$B:XF#$H?=$7$^$9!#e(B

On Wed, 30 Apr 2008 15:14:50 +0900
Yukihiro M. [email protected] wrote:

e$B$H$$$&%F%9%H$,2C$($i$l$F$$$^$9$,!"e(B0**-1e$B$C$FK\Ev$K%<%m$J$s$G$7$ge(B
e$B$&$+!)e(B e$B<j85$N=hM}7O$Ge(B0e$B$K$J$k$b$N$O$J$$$h$&$G$9$,!#e(B

e$BC1$J$k;29M>pJs$G$9$,!“e(B([email protected][email protected]$,B3$$$F$$$ke(B)IEEE
754re$B$N!”:#G/e(B3/16e$B;[email protected]$G$N%I%i%U%He(B
http://grouper.ieee.org/groups/754/email/msg03826.html
e$B$G$O!Ve(Bpowne$B!W!Ve(Bpowe$B!W!Ve(Bpowre$B!W$H$$$&;0<oN$NN_>hA:n$,Dj5A$5$l$F$$$^$9!#$7$+$7e(B

pown (e$B!^e(B0, n) is e$B!^!ge(B and signals the divideByZero exception for odd integral n < 0

pow (e$B!^e(B0, y) is e$B!^!ge(B and signals the divideByZero exception for y an odd integer < 0

powr (e$B!^e(B0, y) is +e$B!ge(B and signals the divideByZero exception for finite y < 0

e$B$H$$$&$3$H$G!"$$$E$l$N>l9g$be(B
0**-1e$B$O!Ve(B+e$B!g$rJV$7!"e(BdivideByZeroe$BNc30$rH/$9$k!W$H$$$&e(B
e$B$3$H$K$J$C$F$$$k$h$&$G$9!#$^$?>e5-$N?6$kIq$$$K$D$$$Fe(B(e$B$6$C$H8+$?8B$j$G$O$G$9$,e(B)e$B$=$N8e$Ne(B
[email protected]$G$O?($l$i$l$F$$$J$$$h$&$G$9!#e(B

e$B$3$l$r??;w$k$J$i$P!"e(BRubye$BE*$K$Oe(B(e$B%G%U%)%k%H$G$Oe(B)e$BNc30$H$7$F<BAu$7$=$&$G$9!#e(B

e$B$&!<$`!"$=$lC1BN$J$i7i$$$+$b$7$l$^$;$s$,e(B
e$BB>$K$O$h$j%W%i%0%^%F%#%C%/$J$H$3$m$b$"$k$H;W$$$^$9!#e(B
e$B%P%i%s%9$r9MN8$7$F$b7i$7$H$G$-$=$&$G$9$+!#e(B

e$B$D$/$P$G?tCM$N2q9g$H$+;}$F$J$$$G$9$+$M$(e(B

e$B$4$H$1$se(B

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs