% This file is embedded in datatool-user.pdf version 3.4.2 2025-11-06
% Example 5 Datum Control Sequences
% Label: "ex:datumcs"
% arara: pdflatex
% arara: pdfcrop
\documentclass[12pt]{article}
\pagestyle{empty}
\usepackage{datatool-base}
\usepackage{siunitx}
\DTLparse{\numA}{23,452}
\DTLparse{\numB}{45.0}
\DTLparse{\numC}{\pounds 24.50}
\DTLsetfpdatum{\numD}{\num{1.5e-4}}{1.5e-4} 
\begin{document}
Original value: \DTLusedatum{\numC} or \numC.
Numeric value: \DTLdatumvalue{\numC}.
Currency: \DTLdatumcurrency{\numC}.
Data type: \number\DTLdatumtype{\numC}. 

\DTLadd{\result}{\numA}{\numB}
$\numA + \numB = \result$ 

\DTLaddall{\result}{\numA,\numB,\numC}
$\numA + \numB + \numC = \result$ 

\dtladd{\result}{\DTLdatumvalue{\numA}}{\DTLdatumvalue{\numB}}
$\DTLdatumvalue{\numA} + \DTLdatumvalue{\numB} = \result$ 

\dtladdall{\result}{\DTLdatumvalue{\numA},\DTLdatumvalue{\numB},\DTLdatumvalue{\numC}}
$\DTLdatumvalue{\numA} + \DTLdatumvalue{\numB} + \DTLdatumvalue{\numC} = \result$ 

\DTLxsetdecimaldatum{\total}{\num{\result}}{\result}
Total: \total. 

\dtlmul{\result}{20}{\DTLdatumvalue{\numD}}
$20 \times \numD = \result$ 
\end{document}
