On Wednesday, 3 May 2023 at 08:21:39 UTC-7 G. M.-S. wrote:
For symbolic expression you should probably walk the entire expression tree.
For sage objects, examining the parents involved should do the trick:
sage: QQ.is_exact()
True
sage: RR.is_exact()
False
However, be careful:
sage: A=matrix(RR,2,2,[1,2,3,4])
sage: parent(A).is_exact()
True
because matrix rings presently aren't aware of inexactness of their base rings. So you should walk the construction of a parent and see if there are any inexact constituents:
sage: parent(A).construction()
(MatrixFunctor, Real Field with 53 bits of precision)