#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 jason):
Replying to [comment:25 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.
I agree. That's the default in Sage now, though (and led to this patch, as
it was hiding too much in my numerical analysis class!)
So changing it should probably be a different ticket, and after this
patch, should just be a one liner change to the defaults.
>
> 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}}}?
Good questions. It's been a while since I worked with this patch (other
than the rough patch from yesterday). I'll try to see what changes are
changes I made, as opposed to what things were already in Sage. The
things that were already in Sage can be dealt with on another ticket.
>
> Just my 2 cents.
>
> Paul
>
> PS: however, the patch for #9261 looks very nice. Can't you make it
independent of that ticket?
Yes, though it's easier to build on top of the framework here, and I hope
better in the long run.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/7682#comment:26>
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.