ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 02 Mar 2017 20:21:57 -0600Difference between RealNumber and RealLiteralhttp://ask.sagemath.org/question/36798/difference-between-realnumber-and-realliteral/I discovered this tonight.
sage: L = srange(-1,1,.01)
sage: type(L[50])
<type 'sage.rings.real_mpfr.RealNumber'>
sage: type(-.5)
<type 'sage.rings.real_mpfr.RealLiteral'>
and hence
sage: -.5 in L
False
In some sense I'm cool with that, but in another sense I'm very annoyed. (Especially since I probably should have known about it but missed this.) So ... what exactly is the difference between these types, and when should they each be used? You might see my confusion given this result:
sage: L[50] in RR
True
sage: -.5 in RR
True
Oh, and this is really awesome:
sage: type(RealNumber(-.5))
<type 'sage.rings.real_mpfr.RealLiteral'>
Also, perhaps if anyone ever makes the full list of real numbers types as in [Question 9950](https://ask.sagemath.org/question/9950/what-are-the-different-real-numbers-in-sage/), one could add these.kcrismanThu, 02 Mar 2017 20:21:57 -0600http://ask.sagemath.org/question/36798/