I am quite new to LaTex and I am wondering if it's possible to use exact math in LaTex. I.e. I want to feed the script some input, which may be either a number or a variable, and it should perform some calculations on it (e.g. multiply/divide) and print the exact solution.
Consider this .tex file:
\documentclass{article}
\newcommand\mass{30}
\newcommand\acc{9.8}
\newcommand\force{\the\numexpr \mass * \acc \relax} % F=m*a
\begin{document}
\section{Exerted force}
F = \force N
\end{document}
This prints F = 270.8N when mass = 30 and acc = 9.8. Can this script, however, be modified in order that changing acc to a variable like g instead of a number will print F = 30g?
EDIT: I should not have used the words 'exact math' as they are misleading as to my intentions. I have rephrased the question and it's posted here: LaTex - perform algebraic operations on variables

\force*that would print30gif\massis known and otherwise (\force) printing the result of the product\mass * \acc. Alternatively, construct something like a key-value interface:\force{mass = 30, acc = g}. Then you can condition on the respective symbols. Would that work for you? – Werner Feb 17 '19 at 19:52