# Tikz - dimension too large while drawing angles

I’m trying to construct a “wrong” protractor for a lab experience showing the concept of systematic error due to a faulty instrument. I figured it was going to be a fairly simple task, and indeed I managed to draw a protractor that has 91° to a right angle as follows.

\documentclass[tikz,border=5pt]{standalone}
\usepackage{tikz,siunitx}
\begin{document}
\begin{tikzpicture}
\foreach \x in {0,...,182}
\draw ({90*\x/91}:10cm) to ({90*\x/91}:11cm);
\foreach[count=\i, evaluate=\i as \lb using int(10*(\i-1))] \x in {0,10,20,31,41,...,111,122,132,...,182}
\draw[line width=2pt] ({90*\x/91}:9cm) node {\ang{\lb}} ({90*\x/91}:9.5cm) to ({90*\x/91}:11cm);
\end{tikzpicture}
\end{document}


For some reason, if I try to make it 93° to a right angle, for a more noticeable effect, I get a “dimension too large” error, and the last few ticks end up superimposed on one another.

\documentclass[tikz,border=5pt]{standalone}
\usepackage{tikz,siunitx}
\begin{document}
\begin{tikzpicture}
\foreach \x in {0,...,186}
\draw ({90*\x/93}:10cm) to ({90*\x/93}:11cm);
\foreach[count=\i, evaluate=\i as \lb using int(10*(\i-1))] \x in {0,10,...,180}
\draw[line width=2pt] ({90*\x/93}:9cm) node {\ang{\lb}} ({90*\x/93}:9.5cm) to ({90*\x/93}:11cm);
\end{tikzpicture}
\end{document}


I have no idea what the issue could be in this situation, intuitively no dimension should become larger than it was in the previous case. I tried scaling back the radius, to no avail.

You need to keep the intermediate computations bounded above: you can for example use a different order 90/93*\x instead. This way the division will be executed first and will never reach the fixed point maximum 16384.

Or use brackets such as 90*(\x/93) such that the different terms are again bounded.

Edit: MWE - with different \and than yours but I have to place it here to have an answer that will not automatically marked as "spam"

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}
\begin{tikzpicture}
\foreach \x in {0,1,...,186}
\draw ({90/93*\x}:10cm) to ({90/93*\x}:11cm);
\foreach[count=\i, evaluate=\i as \lb using int(10*(\i-1))] \x in {0,10,...,180}{
\pgfmathsetmacro\ang{int(90/93*\x)}
\draw[line width=2pt] ({90/93*\x}:9cm) node {\ang} ({90/93*\x}:9.5cm) to ({90/93*\x}:11cm);}
\end{tikzpicture}
\end{document}

• Ah, so basically the other example I provided just barely works, getting to 16380 at most. Talk about luck! – LvdT Jan 19 '18 at 22:36
• Yes... both was close... The first below, the second above... But like a cop would do, pgf got you in the second :P – koleygr Jan 19 '18 at 22:38