#15303: Coercion discovery fails to be transitive
-------------------------------------+-------------------------------------
       Reporter:  nbruin             |        Owner:
           Type:  defect             |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-6.0
      Component:  coercion           |   Resolution:
       Keywords:                     |    Merged in:
        Authors:  Simon King         |    Reviewers:
Report Upstream:  N/A                |  Work issues:  Crash in permgroup.py
         Branch:                     |       Commit:
  u/SimonKing/ticket/15303           |  528a03535447d67f04dc16d0a22cc38def54f9f1
   Dependencies:  #14711, #15329,    |     Stopgaps:
  #15331                             |
-------------------------------------+-------------------------------------

Comment (by nbruin):

 Replying to [comment:99 jdemeyer]:
 > {{{
 > sage: ZZ(CC(1))
 > ...
 > /usr/local/src/sage-5.13.beta1/local/lib/python2.7/site-
 packages/sage/rings/integer.so in sage.rings.integer.Integer.__init__
 (sage/rings/integer.c:7889)()
 >
 > TypeError: unable to coerce <type
 'sage.rings.complex_number.ComplexNumber'> to an integer
 > sage: ZZ(RR(CC(1)))
 > 1
 > }}}
 I don't think it necessarily is related: this is a conversion and given
 how liberal conversion is allowed/meant to be, I don't think we can expect
 convertibility to ever be transitive (I think it will even be path-
 dependent). As the trace shows, it fails in
 `sage.rings.integer.Integer.__init__`, i.e., just the integer constructor.
 I suspect RR has been special-cased there and CC is not (perhaps it
 should). So, the initializer attempts to see if straight coercion works
 and of course it doesn't.

 I don't think these conversions are going to be terribly useful anyway:
 {{{
 sage: ZZ(49*RR(1/49))
 TypeError: Attempt to coerce non-integral RealNumber to Integer
 }}}
 }}}

--
Ticket URL: <http://trac.sagemath.org/ticket/15303#comment:100>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to