# Error caused by TikZ/PGF trigonometric functions

I'm a bit confused about a failure I'm seeing with an inline \cos call. In the code below there I perform contortions with \let, \pgfmathparse, and \pgfmathresult However, the commented line should, in my understanding, do the exact same thing. Instead it fails with an error. I seem to be missing something and I still don't have a good handle on doing math with pgf.

\documentclass{article}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usepackage{pgfplots}

\begin{document}

\tdplotsetmaincoords{60}{155}

\begin{tikzpicture}[scale=5,tdplot_main_coords]
\tikzstyle{grid}=[thin,color=red]

\draw[thick,->] (0,0,0) -- (1,0,0) node[anchor=north east]{$x$};
\draw[thick,->] (0,0,0) -- (-1,0,0);
\draw[thick,->] (0,0,0) -- (0,1,0) node[anchor=north west]{$y$};
\draw[thick,->] (0,0,0) -- (0,0,1) node[anchor=south]{$z$};

\foreach \a in {0, 15, 30, 45, 60, 75, 90}{
\pgfmathparse{cos(\a)};
\let\c=\pgfmathresult;
\tdplotdrawarc[grid]{(0,0,{sin(\a)})}{\c}{0}{180}{}{};
% When this line is uncommented it fails.
%   \tdplotdrawarc[grid]{(0,0,{sin(\a)})}{{cos(\a)}}{0}{180}{}{};
}

\foreach \rot in {-90, -60, -30, 0, 30, 60, 90} {
\tdplotsetrotatedcoords{\rot}{90}{0};
\tdplotdrawarc[grid,tdplot_rotated_coords]{(0,0,0)}{1}{90}{180}{}{};
}

\end{tikzpicture}
\end{document}

-
It works with the current CVS version of TikZ, so I suspect: Using math in TikZ –  Qrrbrbirlbel Mar 24 '13 at 2:12

As pointed out by Qrrbrbirlbel, it's due to a bug, which has already been discussed on the site; here, for instance. That bug should be fixed in the next official TikZ release.

If you have an up-to-date, non-CVS version of TikZ, you will make the error disappear by inserting two spaces in the problematic line, like so:

\tdplotdrawarc[grid]{(0,0,{sin(\a)} )}{{cos(\a)} }{0}{180}{}{};

-
Ah, hadn't seen that discussion. Thanks! –  Andrew Myers Mar 24 '13 at 14:53