<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% macros to calculate sines from 90 to -90
% Jim Walker,  Dept Mathematics,  University of South Carolina
\newdimen\x
\newdimen\y
\newdimen\xsquare
\newdimen\xfourth
{% change char codes
    \catcode`\p=12
    \catcode`\t=12
    \gdef\numonly#1pt{%
        \def\xx{#1}%
    }%
}%
\def\MULTyBYx{%
    \expandafter\numonly\the\x
    \edef\b{\y=\xx\y}%
    \b
}%
\def\calcsin{% Find sin(\x) and put it in \y. Say \x is in degrees.
    \x=0.0174533\x % Convert to radians.
    \y=\x
    \MULTyBYx
    \xsquare=\y
    \MULTyBYx
    \MULTyBYx
    \xfourth=\y
    \y=1pt
    \advance\y by -0.1666666\xsquare
    \advance\y by 0.008333333\xfourth
    \MULTyBYx
}%
% Example of use:
%\x=23pt \calcsin \expandafter\numonly\the\y
% Now \xx should contain the sine of 23 degrees.
%\def\sine#1{\x=#1 \calcsin \expandafter\numonly\the\y \message{sine of
%#1 is \xx}}
%----------------------------------------------------------
% given a box with width W and height H,  then its height after rotation by R
% is W * sin(R) + H * cos(R),  and it extends W * cos(R) to the right
% and H * sin(R) to the left
% (arithmetic courtesy of Nico Poppelier)
%
\newdimen\xh\newdimen\xw\newdimen\xtemp\newdimen\xcos\newdimen\xsin
\newdimen\xleft\newdimen\xright
\def\MULTxtempBYxcos{\expandafter\numonly\the\xcos\edef\b{\xtemp=\xx\xtemp}\b}%
\def\MULTxtempBYxsin{\expandafter\numonly\the\xsin\edef\b{\xtemp=\xx\xtemp}\b}%
</pre></body></html>