Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

They don't come from anywhere special.

sage: x = pi.n(digits=3)
sage: y = QQ(x)
sage: type(y)
<type 'sage.rings.rational.Rational'>
sage: y.n()
3.14150943396226
sage: y.n(digits=100)
3.141509433962264150943396226415094339622641509433962264150943396226415094339622641509433962264150943
sage: n(333/106)
3.14150943396226

Once you turn x into a rational, it behaves as any other rational would. In particular, it has an eventually repeating decimal expansion, etc. The point is that you tried to turn a low-precision number into a rational, and this is what happens. Sorry that the rationals don't 'hold precision', but I don't think this would be intended.