| 1 | initial version |
You can look at the documentation of N with:
sage: N?
You can see that, besides the prec option, there is a digit option that does the job:
sage: print(N(pi, digits=4))
3.142
sage: print(N(pi, digits=6))
3.14159
sage: print(N(pi, digits=12))
3.14159265359
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.