Re: def power, problem when raising power to decimals

2008-04-17 Thread Mark Dickinson
On Apr 16, 11:03 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > | decimal.InvalidOperation: 0 ** 0 > > I would think of this as a bug unless the standard Decimal follows demands > this. It does. From http://www2.hursley.ibm.com/decimal/daops.html#refpower : "If both operands are zero, or if the

Re: def power, problem when raising power to decimals

2008-04-17 Thread colas . francis
On 17 avr, 00:49, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Wed, 16 Apr 2008 19:21:18 -0300, John Machin <[EMAIL PROTECTED]> > escribió: > > > [EMAIL PROTECTED] wrote: > >> also i found a link which states 0^0 isnt 1 even though every > >> calculator ive tried says it is. > >> it doesnt s

Re: def power, problem when raising power to decimals

2008-04-17 Thread skanemupp
actually that 0**0 statement was wrong. 0**0 = 1 and should be. -- http://mail.python.org/mailman/listinfo/python-list

Re: def power, problem when raising power to decimals

2008-04-16 Thread Terry Reedy
"Mark Dickinson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On Apr 16, 4:19 pm, [EMAIL PROTECTED] wrote: > how do i solve power(5,1.3)? > [...] > > also i found a link which states 0^0 isnt 1 even though every > calculator ive tried says it is. > it doesnt say what it is but i pr

Re: def power, problem when raising power to decimals

2008-04-16 Thread Mensanator
On Apr 16, 5:49 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Wed, 16 Apr 2008 19:21:18 -0300, John Machin <[EMAIL PROTECTED]>   > escribió: > > > [EMAIL PROTECTED] wrote: > >> also i found a link which states 0^0 isnt 1 even though every > >> calculator ive tried says it is. > >> it does

Re: def power, problem when raising power to decimals

2008-04-16 Thread Gabriel Genellina
En Wed, 16 Apr 2008 19:21:18 -0300, John Machin <[EMAIL PROTECTED]> escribió: > [EMAIL PROTECTED] wrote: >> also i found a link which states 0^0 isnt 1 even though every >> calculator ive tried says it is. >> it doesnt say what it is but i presume 0 then. >> but it seems the dude is wrong and it

Re: def power, problem when raising power to decimals

2008-04-16 Thread John Machin
[EMAIL PROTECTED] wrote: > how do i solve power(5,1.3)? Is this a trick question? OK, I'll bite: >>> 5 ** 1.3 8.1032829834638136 >>> > > def power(nbr, po): > if po==0: > return 1 > if po>0: > return nbr*power(nbr, po-1) > if po<0: > return 1/power(nbr, -1*

Re: def power, problem when raising power to decimals

2008-04-16 Thread Mark Dickinson
On Apr 16, 4:19 pm, [EMAIL PROTECTED] wrote: > how do i solve power(5,1.3)? > [...] > > also i found a link which states 0^0 isnt 1 even though every > calculator ive tried says it is. > it doesnt say what it is but i presume 0 then. > but it seems the dude is wrong and it is 1? >>> 5**1.3 8.10328

def power, problem when raising power to decimals

2008-04-16 Thread skanemupp
how do i solve power(5,1.3)? def power(nbr, po): if po==0: return 1 if po>0: return nbr*power(nbr, po-1) if po<0: return 1/power(nbr, -1*po) also i found a link which states 0^0 isnt 1 even though every calculator ive tried says it is. it doesnt say what it is