| 1 |
% This file is embedded in datatool-user.pdf version 3.4.3 2025-12-04 |
| 2 |
% Example 3 Performing Calculations with LaTeX3 |
| 3 |
% Label: "ex:l3fptodec" |
| 4 |
% arara: pdflatex |
| 5 |
% arara: pdfcrop |
| 6 |
\documentclass[12pt]{article} |
| 7 |
\pagestyle{empty} |
| 8 |
\ExplSyntaxOn |
| 9 |
\newcommand{\myfunc} [3] |
| 10 |
{ |
| 11 |
\fp_to_decimal:n{ #1 + 0.5 * sqrt(#2) / (#3) } |
| 12 |
} |
| 13 |
\ExplSyntaxOff |
| 14 |
\newcommand{\numA}{1023.5} |
| 15 |
\newcommand{\numB}{54.75000} |
| 16 |
\newcommand{\numC}{-20648.68} |
| 17 |
\begin{document} |
| 18 |
$ \numA+\frac{\sqrt{\numB}}{2\times\numC} = \myfunc{\numA}{\numB}{\numC} $ |
| 19 |
\end{document} |