Simon King wrote: > Hi Marc! > > On 12 Dez., 15:48, Jason Grout <[email protected]> wrote: >> marcW wrote: > [...] >> If you don't care about precision (i.e., all numbers are rounded off to >> 2-3 digits), then you can declare your numbers this way: >> >> sage: R=RealField(15) >> sage: R(pi) > [...] > > Or, if you *do* care about the precision in the computation, but don't > want to see more then 3 digits in the final result, you may do > sage: print 1.0 > 1.00000000000000 > sage: print '%.3f'%1.0 > 1.000
Hmmm. Yeah, 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. Thanks, Jason -- Jason Grout -- 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-support URL: http://www.sagemath.org
