# Avoiding Dimension too large' and ill-formatted floating point' errors in tikz

I am attempting to draw some pictures using tikz, with the decorations library, and am encountering a Dimension too large' error. I have read the 20+ other questions/answers about this error, and have not found them to contain a solution that works in my case. (Apologies if I missed something.) In particular, most of those question seem to have to do with using pgf to do computations, whereas I am just using it to draw, and the error is coming in some process internal to tikz calculating its line paths.

Cutting to the chase, here is a MWE:

\documentclass{amsart}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}
%\usetikzlibrary{fpu}
%\pgfkeys{/pgf/fpu=true, /pgf/fpu/output format=fixed}

\tikzset{
fuzzleft/.style={
preaction={draw,line width=2.5pt,black!25,decorate,decoration={curveto,raise=1.25pt}}}
}

\begin{document}
\begin{tikzpicture}
\draw[fuzzleft] (0,.5) arc (0:180:.2);
\end{tikzpicture}
\begin{tikzpicture}
\draw[fuzzleft] (0,.5) arc (0:180:.17);
\end{tikzpicture}
\end{document}


The first tikzpicture compiles, the second does not. When I put in the fpu and \pgfkeys lines (commented out above), as suggested in various answers, I then get an ill-formatted floating point' error.

(Solutions that involve modifying the picture code itself (eg scaling and changing the numbers to get the same image, changing the specific drawing commands or method, etc) will not help me --- I was coming up with such hacks on each individual picture, but eventually the hacks themselves became unworkable on my actual more elaborate pictures.)

-

There is not much you can do. The problem is with TeX and turning on the fpu library is not going to help you. See it like this, TikZ relies on TeX length registers and other TeX related mechanism to copmute the paths. Then sends to the driver as paths.

Now the driver is pretty good at scaling down objects. But your object description never reaches to the driver. Because TeX can't handle the computations you throw at it. Because of very old but still shiny gears can't crunch anything that precise. By that I mean very tiny arc length due to your line width specification (It's too thick for such arc). SO it is still the same thing. You are hit by PGF computation just as other answers.

Turning on the fpu library doesn't help off the bat because most of the internal PGF commands don't communicate well with it as you noticed when you turned it on. I would consider redrawing your image better and larger and then scale it down. I don't know why you would need such a small object but if you are trying create symbols etc. there might be other ways.

As a proof of concept consider this (zoomed 6400% in AcroRead)

\documentclass{amsart}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}
\tikzset{
fuzzleft/.style={
preaction={draw,line width=20pt,black!25,decorate,decoration={curveto,raise=1.25pt}}
}
}
\begin{document}
\scalebox{0.05}{%
\begin{tikzpicture}[scale=5]
\draw[fuzzleft,line width=2pt] (0,.5) arc (0:180:.17);
\end{tikzpicture}%
}
\end{document}


Once you can draw it you can scale ridiculously. But in your example you can't draw it.

-
Thanks, this is definitely helpful. I am trying to use scalebox to do what I need, and hope I will succeed. I have already encountered issues with this, eg tex.stackexchange.com/questions/150721/…, but perhaps each such issue will be hackable. –  Chris Dec 19 '13 at 18:32
(It still seems to me rather unreasonable that a sophisticated drawing program would be unable to perform floating point calculations. But I suppose TikZ ist kein Zeichenprogramm.) –  Chris Dec 19 '13 at 18:34
@Chris TeX is old. –  percusse Dec 19 '13 at 18:40
Old and wise, I suppose. // Another issue that has arisen with scalebox is that it sometimes seems to use the original (rather than scaled-down) bounding box, resulting in enormous whitespace. I need a way to shrinkwrap the figure after it has been scaled down. Hmm ... –  Chris Dec 19 '13 at 19:17