Ask Your Question

Revision history [back]

Fields of algebraic nature (like RationalField, NumberField, AlgebraicField, AlgebraicRealField) are assumed to be exact, hence no rounding is done there. You can check that there was no conversion done along the algorithm you used by testing you result with the method .parent(). If you get fields like Symbolic Ring, RealDoubleField, RealField, then the algorithm you used did some rounding. You can check that a given field is exact with the .is_exact() method. You could have a look at this question for a bigger list of fields.

For example, if you try

sage: (1/7)^100000

you will get an exact rational with a huge denominator, not a floating approximation.

When you speak about having a result like p^100-2 instead of p^100, maybe you want to speak about overflow problems, not rounding problems. This could happen if you don't have enough memory, but then you you should get an error, not a wrong answer. For example,

sage: b = (1/7)^10000000000
RuntimeError: Segmentation fault

Note also that relying on the result does not only depend on whether roundings and overflow may happen, but also related to the existence of bugs in Sage, if you are convinced Sage didn't give you the right result, maybe you found one, so please report it ;)