#15888: CC -> PARI: return t_REAL for real numbers
-------------------------------------+-------------------------------------
       Reporter:  jdemeyer           |        Owner:
           Type:  enhancement        |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-6.2
      Component:  interfaces         |   Resolution:
       Keywords:                     |    Merged in:
        Authors:  Jeroen Demeyer     |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/jdemeyer/ticket/15888            |  988c1f8870435bac8fb097e4d6a8aad62f84d19e
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by pbruin):

 It would seem to make sense to treat purely imaginary numbers similarly,
 by setting the real component to the `t_INT` 0, as PARI does.  With your
 patch,
 {{{
 sage: pari(CC(1))
 1.00000000000000
 sage: pari(CC(I))
 0.E-19 + 1.00000000000000*I
 sage: _.debug()
 [&=0000000004a45468] COMPLEX(lg=3):0c00000000000003 0000000004a45458
 0000000004a45440
   real = [&=0000000004a45458] REAL(lg=2):0400000000000002
 (0,expo=-64):1fffffffffffffc0
   imag = [&=0000000004a45440] REAL(lg=3):0400000000000003
 (+,expo=0):6000000000000000 8000000000000000
 sage: pari('1.0*I')
 1.00000000000000*I
 sage: _.debug()
 [&=000000000332b280] COMPLEX(lg=3):0c00000000000003 000000000332b270
 000000000332b250
   real = [&=000000000332b270] INT(lg=2):0200000000000002
 (0,lgefint=2):0000000000000002
   imag = [&=000000000332b250] REAL(lg=4):0400000000000004
 (+,expo=0):6000000000000000 8000000000000000 0000000000000000
 }}}

--
Ticket URL: <http://trac.sagemath.org/ticket/15888#comment:3>
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