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()
sage: y.n(digits=100)
sage: n(333/106)

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.