Update: This has problems if the samples are one of these: {19,21,23,28,30,31,32,34,36,38,39}, so I think something else is going on.



I can get this example to work fine if I reduce the number of samples to 40 or below. Otherwise, this results in an incorrect graph. I am wondering if this seemingly huge round off problem might indicate that there is some other underlying problem with the math engine. So, is this a know issue, and I just have to make sure that I adjust the number of samples based on what is being plotted?  

The MWE example below produces the following output as it stands now, when it should just be a straight line.



\documentclass{article}
\usepackage{pgfplots}
\usepackage{amsmath}

\begin{document}
\begin{tikzpicture}
\begin{axis}[xmin=-4,xmax=+0, ymin=-0.5,ymax=4.5] 

\addplot[draw=blue, mark=none, ultra thick, domain=-4.0:-0.1,
         samples=100] % Fine is sample &lt; 42, and NOT {19,21,23,28,30,31,32,34,36,38,39}
    {(3*x + abs(x))/x}
    node [midway, above right] {$y=\frac{3x + |x|}{x}$}; 

\end{axis} 
\end{tikzpicture}
\end{document}




Update 2011-11-03: Am not able to reproduce this behavior with the current TeXLive2011 release, so problem is definitely fixed.


Question: Refresh Downloads list
Answer: This is a correction for Akhil's answer. I have tried this on Android Lollipop and it works :

Settings > Apps > All > Download Manager (NOT Downloads) > Clear Data and Clear Cache.