#18076: Coercion for numpy types
-------------------------------------+-------------------------------------
       Reporter:  vdelecroix         |        Owner:  vdelecroix
           Type:  enhancement        |       Status:  needs_work
       Priority:  major              |    Milestone:  sage-6.7
      Component:  coercion           |   Resolution:
       Keywords:  sd66               |    Merged in:
        Authors:  Vincent            |    Reviewers:  Jeroen Demeyer,
  Delecroix, Jeroen Demeyer          |  Vincent Delecroix
Report Upstream:  N/A                |  Work issues:
         Branch:  u/jdemeyer/18076   |       Commit:
   Dependencies:  #18121             |  d4c53ac38372916a2e81100e2c4dd360b5afcf51
                                     |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by vdelecroix):

 Replying to [comment:37 jdemeyer]:
 > I'm also wondering if this check is really needed:
 > {{{
 > if ty != type(y + x):
 >     raise RuntimeError("x + y and y + x have different types...")
 > }}}
 >
 > First of all, I cannot find any case where this happens.

 {{{
 sage: numpy.int16(1) + 1.0
 2.0
 sage: type(_)
 <type 'numpy.float64'>
 sage: 1.0 + numpy.int16(1)
 2.00000000000000
 sage: type(_)
 <type 'sage.rings.real_mpfr.RealNumber'>
 }}}
 But the canonical coercion is fine since we do have a coercion from numpy
 types to real numbers.

 > Second, even if it does happen, would it really be a problem?

 I don't know. You would prefer that we get rid of it?

 Vincent

--
Ticket URL: <http://trac.sagemath.org/ticket/18076#comment:38>
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/d/optout.

Reply via email to