Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

%.20f' % (z.sqrt()) is a Python string expression using Python numeric formatting, which is unaware of Sage's arbitrary precision numericals ; your arbitrary precision value is therefore first converted in a Python float before being passed tro Python's numerical formatting. Use Sage's numerical formatting to obtain a string representationof the desired precisin.

In Sagecell :

R = RealField(200)
z = R(2.0)
print '%.20f' % (z.sqrt())
print repr(z.sqrt().n(digits=20))

1.41421356237309514547
1.4142135623730950488