I have the code:
\documentclass[tikz,border=5]{article}
\usepackage{tikz}
\usepackage{xfp}
\usepackage{amsmath}
\usetikzlibrary{math}
\usepackage{fp}
\usetikzlibrary{fixedpointarithmetic}
\begin{document}
\tikzset{fixed point arithmetic}
\tikzmath{
real \x; real \y;
%
\x=-1.3754;
\y = \fpeval{round(\x*5.56,3)};
}
\tikzset{fixed point arithmetic}
\tikzmath{
real \z; real \w;
%
\z=1.3754;
\w = \fpeval{round(\z*5.56,3)};
}
\vspace{3cm}
O valor de $x$ é: \fpeval{round(\x,3)} \
O valor de $y$ é: \y \
O valor de $z$ é: \fpeval{round(\z,3)} \
O valor de $w$ é: \w \
\end{document}
whose output is the following:
When I operate negative numbers in tikzmath, the decimal places of the result is incontrolable. However when the calculation deal with positive real numbers, I set the decimal places with \fpeval{round(x,3)} (to three decimal places) and I can to control the precision.
My question is how can I fix this? Why fixed point arithmetic is noisy with negative numbers? I would to set the decimal places in the tikzmath code space, not in the text.
Many thanks!


O valor de $y$ é: \fpeval{round(\y,3)}works. No idea why – user202729 Dec 15 '21 at 00:55round()to print number to X decimal places feel absolutely like the wrong way. – user202729 Dec 15 '21 at 00:55-7.647 == -7.6470000000000. What you want is to print the number to 3 decimal places. – user202729 Dec 15 '21 at 01:01pgfmathprintnumber, which works in this case. – user202729 Dec 15 '21 at 01:02tikzmathmode when the number is negative. When Is positive the commandroundworks. Try! – Angelo Aliano Filho Dec 15 '21 at 01:05siunitxcan be used too. https://tex.stackexchange.com/questions/599426/xfp-zerofill-at-fpeval – user202729 Dec 15 '21 at 01:21