[Tex/LaTex] design a macro that replaces \divide

macros

One of
the arithmetic instructions (\divide) does not even have an equivalent in standard
LaTeX.
The inx expressions can be used in arguments to macros (the calc package
doesn't employ category code changes to achieve its goals)

Best Answer

There are a number of libraries that can be used for calculations with LaTeX perhaps the best being the fp package. There is also an equivalent available in LaTeX3. To divide you type:

   \FPdiv\result{3}{7}

With the result being available in \result.

Here is a full minimal:

\documentclass{article}
\usepackage{fp}
\begin{document}
\FPdiv\result{3}{7}
\result
\end{document}