<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">
<DIV class=gmail_quote style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">On Mon, Apr 21, 2008 at 12:07 AM, Alan Gauld &lt;<A href="mailto:alan.gauld@btinternet.com" target=_blank rel=nofollow ymailto="mailto:alan.gauld@btinternet.com">alan.gauld@btinternet.com</A>&gt; wrote:<BR></DIV>
<P class=gmail_quote style="PADDING-LEFT: 1ex; FONT-SIZE: 12pt; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid; FONT-FAMILY: times new roman, new york, times, serif"><BR>&gt;&gt;&gt; pow(-20, 0.3333333)<BR>Traceback (most recent call last):<BR>&nbsp;File "&lt;stdin&gt;", line 1, in &lt;module&gt;<BR>ValueError: negative number cannot be raised to a fractional power<BR>&gt;&gt;&gt; -20**0.3333333<BR>-2.7144173455393048<BR>&gt;&gt;&gt;<BR></P>
<P class=gmail_quote dir=ltr style="PADDING-LEFT: 1ex; FONT-SIZE: 12pt; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid; FONT-FAMILY: times new roman, new york, times, serif">I think you're confusing the order of operations.<BR><BR>math.pow(-20, (1.0/3.0)) and -20**(1.0/3.0) are not equivalent<BR><BR>Whereas, as john mentioned, -20**(1.0/3.0) is actually -(20**(1.0/3.0)), math.pow(-20, (1.0/3.0)) is (-20)**(1.0/3.0)<BR></P>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">Yes, quite correct, I posted my reply before the others had </DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">posted theirs although it showed up afterwards(at least on gmane)</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">&nbsp;</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">&gt; exponentiation has higher precedence over positive, negative.</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">&nbsp;</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">Yep, I hadn't realized that, although it does make sense when you think about it :-)</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"><BR><I>&gt; Note that math.pow is unrelated to the builtin power operator </I></DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"><I>&gt; and the result of math.pow(0.0, -2.0) will vary by platform. </I></DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"><I></I>&nbsp;</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"><I>This is interesting, I had assumed that pow simply called **.</I></DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">Does anyone know why they made it different?</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">&nbsp;</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">Alan G.</DIV></DIV></div></body></html>