You can't do that directly. In TeX, a length can be only divided by integers. eTeX's \dimexpr
and \numexpr
can do nothing but what Knuth TeX's primitives can do. Thus the calculation 1cm/3.14 is not supported.
There is a trick to do this kind of calculation in TeX:
\documentclass{minimal}
\def\psPi{3.1415926}
\newcount\tmpcntA
\newdimen\tmpdimA
\newcount\tmpcntB
\newdimen\tmpdimB
\begin{document}
\tmpdimA=2cm
\tmpcntA=\tmpdimA % 3729359, in sp
\tmpdimB=\psPi pt
\tmpcntB=\tmpdimB % 205887, in sp
\divide\tmpcntA by \tmpcntB % 3729359 / 205887 = 2cm / 3.1416926pt
\tmpdimA=\tmpcntA pt % 2cm / 3.1415926pt * 1pt
% = 2cm / 3.1415926
\the\tmpdimA % 2cm/3.1415926 = 18.0pt
\end{document}
But it's not precise because of truncation. The approch cannot be used in many situations.
The better way is to use other method to do the calculation: fp
package, pgf
's math engine, raw PostScript calculation, etc.
I'm not very familar with PSTricks, here is the pst-fp
solution:
\documentclass{minimal}
\usepackage{pstricks-add}
\pstFPdiv\result{2}{\psPi} % pst-fp is used
\psset
{
xunit=\result cm, % 0.636619773... cm
yunit=1cm
}
\begin{document}
\begin{pspicture}[showgrid](0,-1)(\psPi,1)
\psplot[plotpoints=300,algebraic]{0}{\psPi}{sin(2*x)}
\end{pspicture}
\end{document}