Why does \pgfmathresult
display the result of 3×4 as 12.0?
\documentclass{article}
\usepackage{pgf}
\begin{document}
\pgfmathparse{3*4}
\pgfmathresult
\end{document}
This code yields a document whose sole contents is "12.0".
In some parts of the document I'm working on, I'll need decimal places, but not for grade 2 math.
How do I fix this?
Best Answer
First, you are not formatting the number when you say
\pgfmathresult
. Second, you have not specified any particular format for number printing. (Although the default format will do, in this case.)Compare:
PGF doesn't know you are typesetting Grade 2 maths rather than a doctoral dissertation in nuclear engineering!