Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

unexpected(?) conversion to float while raising an integer to power -1

This is what I observe in Sage 9.3:

sage: type(29**(-1))                                                                                                                                                                                       
<class 'sage.rings.rational.Rational'>
sage: type(ZZ(29)**(-1))                                                                                                                                                                                   
<class 'sage.rings.rational.Rational'>
sage: type(int(29)**(-1))                                                                                                                                                                                  
<class 'float'>

Why the last result is 'float'? Is it a bug or an expected behavior?