I am trying to do some plots with spherical coordinates and have a problem when computing some numbers in PGFPLOTS.
I add a MWE here:
\documentclass[12pt]{standalone}
\usepackage[pdftex]{graphicx}
\usepackage{amsmath}
\usepackage{tikz,pgfplots}
\begin{document}
% compute angles
\pgfmathsetmacro\a{-pi/5}
\pgfmathsetmacro\b{pi/10}
\pgfmathsetmacro\phil{\a-\b}
\pgfmathsetmacro\phih{\a+\b}
\pgfmathsetmacro\thetal{\a-\b}
\pgfmathsetmacro\thetah{\a+\b}
\pgfmathsetmacro\s{cos(\thetal)*sin(\phil)}
% this should be about -0.476
\pgfmathprintnumber{\s}
\end{document}
Here is the result:
I should get $-0.4755282581475768$




\pgfkeys{/pgf/trig format=rad}. – Torbjørn T. Sep 22 '20 at 14:34