#7682: Customize printing of real numbers
--------------------------------+-------------------------------------------
   Reporter:  jason             |       Owner:  AlexGhitza
       Type:  defect            |      Status:  new       
   Priority:  major             |   Milestone:  sage-4.3  
  Component:  basic arithmetic  |    Keywords:            
Work_issues:                    |      Author:            
   Upstream:  N/A               |    Reviewer:            
     Merged:                    |  
--------------------------------+-------------------------------------------
 From http://groups.google.com/group/sage-
 support/browse_thread/thread/06756df51d828bf4

 {{{
 we probably ought to make this easier to just print the
 first n digits after the decimal by default for RR numbers, or to not
 print out the trailing zeros.  I can't imagine telling my students, for
 example, that they need to do '%.3f'%num every time they come across a
 number, especially since they just want to display the equation, not
 format it as a string.

 What do people think about this interface?

 sage: RR.print_digits=3
 sage: 3.09384
 3.094
 sage: RR.print_trailing_zeros=False
 sage: RR.print_digits=None
 sage: 3.09384
 3.09384

 Make it something like the RR.scientific_notation flag that is currently
 in use.
 }}}

 Additionally, and more flexibly, we could just have something like:

 {{{

 sage: RR.set_print_format('%.3f')
 sage: RR(pi)
 3.142
 }}}

 or more pythonically

 {{{
 sage: RR.print_format = '%.3f'
 sage: RR(pi)
 3.142
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/7682>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.


Reply via email to