% This file is embedded in datatool-user.pdf version 3.4.1 2025-04-25
% Example 4 Performing Calculations with LuaLaTeX
% Label: "ex:directlua"
% arara: lualatex
% arara: pdfcrop
\documentclass[12pt]{article}
\pagestyle{empty}
\newcommand{\myfunc}[3]{% 
 \directlua{tex.print(#1+0.5*math.sqrt(#2)/(#3))}% 
}
\newcommand{\numA}{1023.5}
\newcommand{\numB}{54.75000}
\newcommand{\numC}{-20648.68} 
\begin{document}
 $ \numA+\frac{\sqrt{\numB}}{2\times\numC} = \myfunc{\numA}{\numB}{\numC} $ 
\end{document}
