I'm not quite sure if this count as a bug. In the following example the definition of testA contains a spurious space. This space deplaces the bounding box of the resulting tikzpicture/plot but curiously only with pdflatex and lualatex. With xelatex both bounding boxes are fine.
\documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=1.16} \begin{document} \pgfmathdeclarefunction{testA}{1}{% \pgfmathparse{2} %spurious space } \pgfmathdeclarefunction{testB}{1}{% \pgfmathparse{2}% } xx\begin{tikzpicture} \begin{axis} \addplot {testA(1)}; \end{axis} \end{tikzpicture}yy xx\begin{tikzpicture} \begin{axis} \addplot {testB(1)}; \end{axis} \end{tikzpicture}yy \end{document}
Fixed in https://sourceforge.net/p/pgf/git/ci/00f4e8d4154dcb3133ed4a106b6254b8faf874e2/ but it broke
gcd
. I hope it won't break too much else.As a little gimmick you can get a spaces inside the definition using
~
like inexpl3
.