Since m1.nbits() is 178, work to higher precision:

sage: R = RealField(200)
sage: R(m)==R(m1)
False
sage: R(m)-R(m1)
0.89272832870483398437500000000000000000000000000000000000000

This seems to be what is wanted.  I agree that it is bad that m==m1 gives
True: m is in the Symbolic Ring (check m.parent()) while m1 is an Integer,
and when you ask whether they are equal they are pushed into a common place
where this can be tested, which looks like the default real field (only 53
bits).  Even if one sets d=m-m1, so that d is a single element of SR which
is certainly not the same as SR(0):


sage: d = m-m1
sage: d.parent()
Symbolic Ring
sage: d
540579833922455191419978421211010409605356811833049025*sqrt(1/2) -
382247666339265723780973363167714496025733124557617743

we find the bizzarre conclusion

sage: d.is_zero()
True

showing that "being zero" in SR is a peculiar concept indeed.

John

PS Testing over QQbar certainly does give False, as it would for
m*sqrt(1/2) and n for any pair of integers (m,n) not (0,0), since sqrt(2)
is irrational!

On 13 July 2015 at 12:35, Nathann Cohen <nathann.co...@gmail.com> wrote:

> > Is there a way to force a more exact equality test?
>
> It works "as intended" over QQbar:
>
> sage: QQbar(m) == QQbar(m1)
> False
>
> Nathann
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-support+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-support@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to