[Tex/LaTex] PGF math engine imprecise

calculationstikz-pgf

The command \pgfmathparse{asin(1/\x)} yields for each \x in the range of 125 to 142 the same value, whereas \pgfmathparse{1/\x} yields the much more precise values for each \x. Is the ArcSin function of PGF that imprecise?
What can i do to get more precise results?

MWE:

\documentclass[11pt]{minimal}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
    \foreach \x in {120,121,...,150}
    {
        \pgfmathparse{1/\x}\let\fraction\pgfmathresult
        \pgfmathparse{asin(\fraction)}\let\angle\pgfmathresult
        \node at (0, \x/2-60) {\x, \fraction, \angle}; 
    }
\end{tikzpicture}
\end{document}

Best Answer

There are different math engines that can be used with pgf/TikZ.

Library fixedpointarithmetic

\documentclass[11pt]{minimal}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{fp}
\usetikzlibrary{fixedpointarithmetic}
\begin{document}
\begin{tikzpicture}[fixed point arithmetic]
    \foreach \x in {120,121,...,150}
    {
        \pgfmathparse{1/\x}\let\fraction\pgfmathresult
        \pgfmathparse{asin(\fraction)}\let\angle\pgfmathresult
        \node at (0, \x/2-60) {\x, \fraction, \angle};
    }
\end{tikzpicture}
\end{document}

fixedpointarithmetic