#7682: Customize printing of real numbers
---------------------------+------------------------------------------------
Reporter: jason | Owner: AlexGhitza
Type: enhancement | Status: needs_work
Priority: major | Milestone: sage-4.4.4
Component: numerical | Keywords:
Author: Jason Grout | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
---------------------------+------------------------------------------------
Comment(by zimmerma):
Jason,
sorry, I was not aware of this ticket. I see you have invested a lot of
time in it. However I am
not in favour of removing trailing zeroes by default. Those zeroes are
quite helpful to give an
idea of the accuracy of the computation.
About reducing or increasing the number of printed zeroes with respect to
the internal precision,
I don't see why this could be desirable. If we reduce the number of
printed zeroes, then if we
copy/paste the number, we will loose some accuracy (because of the
decimal<->binary conversion).
If we increase the number of printed zeroes, the user will see more
significant digits (due to
the internal binary representation) and this will lead to more user
questions:
{{{
sage: a=n(pi); a
3.14159265358979
sage: print '%.3f'%a
3.142
sage: b=3.142; a-b
-0.000407346410206788
sage: print '%.30f'%a
3.141592653589793115997963468544
}}}
In addition I don't understand how you achieve this:
{{{
sage: RR.print_trailing_zeros=False
sage: RR.print_digits=None
sage: 3.09384
3.09384
}}}
What happens with {{{RR.print_digits=16}}}?
Also, what happens with numbers with tiny or huge exponent, say
{{{3.09384e-100}}} or
{{{3.09384e+100}}}?
Just my 2 cents.
Paul
PS: however, the patch for #9261 looks very nice. Can't you make it
independent of that ticket?
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/7682#comment:25>
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.