I would like to have the variables (defined in Latex3) aligned in a table with the decimal point. Of course, without using the "trial and error" extra space ",". Is there any possibility? Thank you very much.
P.S. This question is specific to Latex3 and should not be assimilated to a Latex2e well known method to align numbers in tables.
\documentclass{article}
\usepackage{xparse}
\usepackage[version=4]{mhchem}
\usepackage{siunitx,booktabs}
%
\ExplSyntaxOn
\NewDocumentCommand{\calcnumd}{o m}
{\IfValueTF{#1}
{\num[round-mode = figures, round-precision = #1, round-integer-to-decimal]{\fp_to_decimal:n{#2}}}
{\num{\fp_to_decimal:n{#2}}}
}
% data
\fp_set:Nn \dhfbiox {33.18}
\fp_set:Nn \dhftetrox {9.16}
\fp_set:Nn \dgfbiox {51.31}
\fp_set:Nn \dgftetrox {97.89}
\fp_set:Nn \cpbiox {37.20}
\fp_set:Nn \cptetrox {77.28}
% calculations
%
\ExplSyntaxOff
%
\begin{document}
\begin{center}
\begin{tabular}{l|ccc}
& $\Delta_f H^{\ominus}$ & $\Delta_f G^{\ominus}$ & $C_P$ \
& \si{\kilo\joule\per\mole} & \si{\kilo\joule\per\mole} & \si{\joule\per\kelvin\per\mole} \
\midrule
\ce{NO2} & \calcnumd{\dhfbiox} & \calcnumd{\dgfbiox} & \calcnumd[4]{\cpbiox} \
\ce{N2O4} & ,,,\calcnumd{\dhftetrox} & \calcnumd{\dgftetrox} & \calcnumd{\cptetrox} \
\bottomrule
\end{tabular}
\end{center}
\end{document}

siunitxis written usingexpl3, so I don't understand what other “LaTeX3” you want, other than the\fp_set:Nnyou used... – Phelype Oleinik Sep 19 '20 at 14:14\calcnumdis a robust command, siunitx has no chance to expand it to a number and to align it (and no other command would have a chance either). – Ulrike Fischer Sep 19 '20 at 20:12\calcnumin each cell – David Carlisle Sep 19 '20 at 20:14