Hi Marco, I read that comment, but it looks like the coercion framework does what it > should. RR(oo) == oo is evaluated by coercion to InfinityRing, where > positive infinity equals positive infinity: > > sage: oo > +Infinity > sage: oo.parent() is InfinityRing > True > sage: InfinityRing.has_coerce_map_from(RR) > True >
Right, from that perspective it is hard to argue that there is a bug. > As far as I can see, to make RR(oo) == oo evaluate to False (or give an > error), while staying consistent with the coercion framework, one would > need to either > - disallow the explicit conversion RR(oo), or > - remove the automatic coercion from RR to InfinityRing, or > - make InfinityRing(RR(oo)) finite. > The only two options that seem acceptable to me are - disallowing RR(oo) (if RR is taken to represent the field of real numbers as opposed to the extended real line); - making the "in" keyword treat infinity as a special case. This could be defended by saying that representing infinity in RR or CC is possible for convenience, but should not be viewed as an instance of set-theoretical containment. I think this is similar to saying that +0.0 and -0.0 are represented differently in our implementation of floating-point arithmetic, but should be regarded as equal by comparison operators. The following all make sense and look useful: > > sage: UnsignedInfinityRing.has_coerce_map_from(RR) # natural map RR --> > {finite, infinite} > True > sage: UnsignedInfinityRing.has_coerce_map_from(CC) # natural map CC --> > {finite, infinite} > True > sage: InfinityRing.has_coerce_map_from(RR) # natural map RR --> { -oo, > negative, 0, positive, +oo} > True > sage: InfinityRing.has_coerce_map_from(CC) # no natural map CC --> { -oo, > negative, 0, positive, +oo} > False > Yes, I cannot think of any reason to change this. Peter -- 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. For more options, visit https://groups.google.com/groups/opt_out.