The following example:
\documentclass{article}
\usepackage{sagetex}
\begin{document}
\sage{0.1*0.1}
\end{document}
gives
which is totally undesirable.
A brief googling shows that Sage does recognize number formatting such as
How can I utilize such feature in LaTeX? Obviously I cannot write
\sage{"%.3f"%(.1*.1)}
due to the special meaning of %.
Edit
This question is solved with two independent answers. However, I would like to know if there is any official way to assign formatting once and for all. Maybe something like
\begin{sagesilent}
please print only two digits thank you
\end{sagesilent}
and
\begin{sagesilent}
from now on ten digits please
\end{sagesilent}
Just like we use \pgfkeys{/pgf/number format/foo=bar} to configure \pgfmathprintnumber.




\percentfor that purpose. manual found here: ftp://ftp.rrzn.uni-hannover.de/pub/mirror/tex-archive/macros/latex/contrib/sagetex/sagetexpackage.pdf – naphaneal Jun 21 '16 at 13:12