On 2/2/11 9:48 PM, Dan Drake wrote:
This is slightly annoying and unexpected:

     sage: 2^(1.5)
     2.82842712474619
     sage: int(2)^(1.5)
     ---------------------------------------------------------------------------
     TypeError                                 Traceback (most recent call last)

     /home/drake/research/motzkin_plateau/<ipython console>  in<module>()
     TypeError: unsupported operand type(s) for ** or pow(): 'int' and 
'sage.rings.real_mpfr.RealLiteral'

This surprised me when I had something like this:

[n^(1.5) for n in range(5)]

It's trivial to work around this, with ZZ(n) or with [0..4] or whatever,
but it was unexpected. Is this a bug? Does it deserve a trac ticket, or
a smarter user?


It's int(2)**(1.5). The ** is the exponentiation operator in python. We just override the xor operator (^) to also be exponentiation for Sage integers.

Jason

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to