Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

can i display only two decimals of precision

I have some lists I want to display. I don't want to limit the precision for the arithmetic that created them, I only want to limit the number of decimal places (not significant figures) that are displayed.

def f(n): return sorted([ 2*cos(2*3.14159*j/n) for j in range(n) ]) ;
f(5)

Gives me the five required values displayed with what seems to be 14 digits after the decimal. Is it possible to change 14 to some other value?