\documentclass[a4paper]{article}

\usepackage{pgfplots}
%\usepgflibrary{fpu}


\begin{document}

\def\expected{5.0}

\makeatletter
\pgfmathdivide@{83.407811000}{16.68156400}
\pgfmathresult
\message{RESULT = \pgfmathresult. EXPECTED: \expected\space(gnuplot would return 4.99999946048224)^^J} 

\ifx\pgfmathresult\expected
\else
	\PackageError{assert}{test failure: expected \expected, but got \pgfmathresult^^J}%
\fi

\def\expectedgnuplot{0.594681701265387}
\def\expected{0.59468}
\pgfmathdivide@
	{31.404251000}{52.80850400}
% OK:	{31.4053942781504000}{52.810788556300800}
\pgfmathresult

\message{RESULT = \pgfmathresult. EXPECTED: \expected\space(gnuplot would return \expectedgnuplot)^^J} 

\ifx\pgfmathresult\expected
\else
	\PackageError{assert}{test failure: expected \expected, but got \pgfmathresult^^J}%
\fi

\begingroup
\pgf@x=5.0pt
\edef\pgfmathresult{\pgfmath@tonumber@notrailingzero\pgf@x}
\pgfmathresult
\def\expected{5.}%
\ifx\pgfmathresult\expected
\else
	\PackageError{assert}{test failure: expected \expected, but got \pgfmathresult^^J}%
\fi


\pgf@x=5.12pt
\edef\pgfmathresult{\pgfmath@tonumber@notrailingzero\pgf@x}
\pgfmathresult
\def\expected{5.12}%
\ifx\pgfmathresult\expected
\else
	\PackageError{assert}{test failure: expected \expected, but got \pgfmathresult^^J}%
\fi


\def\pgfmathresult{0.59467}
\expandafter\pgfmathdivide@advance@last@digit\pgfmathresult CCCCC\@@
\def\expected{0.59468}
\ifx\pgfmathresult\expected
\else
	\PackageError{assert}{test failure: expected \expected, but got \pgfmathresult^^J}%
\fi
\endgroup
\end{document}

