I forgot to mention that this also happens: sage: f = float(2.0) sage: f^1000000 --------------------------------------------------------------------------- OverflowError Traceback (most recent call last)
/home/travis/sage-5.5.rc0/devel/sage-combinat/sage/combinat/<ipython console> in <module>() /home/travis/sage-5.5.rc0/local/lib/python2.7/site-packages/sage/rings/integer.so in sage.rings.integer.Integer.__pow__ (sage/rings/integer.c:13728)() OverflowError: (34, 'Numerical result out of range') Best, Travis On Thursday, January 31, 2013 5:16:02 PM UTC-5, Travis Scrimshaw wrote: > > Hey everyone, > While working on #13840, I noticed that sage's InfinityRing did not > coerce a floating point infinity, so the following occurs: > > sage: oo == float('+inf') > False > sage: float('inf') < oo > True > > What I am proposing is on ticket > #14045<http://trac.sagemath.org/sage_trac/ticket/14045>which does a coercion > to sage's infinity. However floating points are > converted to infinity when an overflow occurs: > > sage: f = float(2.0) > sage: type(f) > <type 'float'> > sage: f = f^1000 > sage: f*f > inf > sage: type(_) > <type 'float'> > > So is this coercion a valid thing to do? > > Thanks, > Travis > > Also here's what happens with a few other similar type of elements: > > sage: r = 2.0 > sage: type(r) > <type 'sage.rings.real_mpfr.RealLiteral'> > sage: r = r^100000000 > sage: r = r^100000000 > sage: r > +infinity > sage: type(r) > <type 'sage.rings.real_mpfr.RealNumber'> > sage: r == oo > False > sage: r < oo > True > > sage: r = RDF(2.0) > sage: r > 2.0 > sage: type(r) > <type 'sage.rings.real_double.RealDoubleElement'> > sage: r = r^100000000 > sage: r > +infinity > sage: type(r) > <type 'sage.rings.real_double.RealDoubleElement'> > sage: r == oo > False > sage: r < oo > True > > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel?hl=en. For more options, visit https://groups.google.com/groups/opt_out.