# Pgfplots jump mark error when plotting a floor function

For some weird reason the following code gives me the wrong plot

\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\end{axis}
\end{tikzpicture}
\end{document}


Clearly, at for instance x=15, y should equal to 6. Is this a bug?

Added: I've noticed that the floor() function is superfluous in this case - the jump mark left option works just like a floor function, which produces the correct graph. Still, this does not justify the above erroneous example.

-

I'd guess that this is a floating point rounding error (even though \pgfmathparse{floor(((5-2.5)*6)/2.5)}\pgfmathresult correctly prints 6.0). Calculations done using TeX's dimensions have poor precision. One way to fix it is to add a small number to the argument of floor:

\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}

I agree with the solution - here is just a small footnote for the understanding: The \pgfmathparse experiment is not quite complete -- you need to call \pgfkeys{/pgf/fpu} before evaluating the expression to reproduce the behavior of pgfplots. In that case, it returns 5.9999 as result of 15/2.5. Note that the ... syntax in samples at might also introduce rounding errors. –  Christian Feuersänger Apr 21 '11 at 19:05