Aha! Thanks for the explanation.

On Apr 10, 2007, at 9:23 PM, William Stein wrote:

> On 4/10/07, Yi Qiang <[EMAIL PROTECTED]> wrote:
>> sage: QQ
>> Rational Field
>> sage: sqrt(2) in QQ
>> True
>>
>> This looks awfully wrong to me.
>
> This is correct, because sqrt(2) is a floating point approx.  When  
> sqrt is
> replaced by a symbolic function "sqrt", which will happen in the  
> not-to-distant
> future, then sqrt(2) will be an exact object, and it won't be in  
> QQ.  But all
> floats are in QQ.  Also, note that "a in X" means "a is equal to some
> elements of X".
>
> sage: a = sqrt(2)
> sage: a
> 1.41421356237310
> sage: b = QQ(a)
> sage: b
> 4058818056/2870017771
> sage: a == b
> True
>
> William

Cheers,
Yi

--
http://www.yiqiang.net



--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to