Related with this question, I would like to perform arithmetic operations of siunitx numbers that have uncertainties. For example multiply two numbers using \mult{0.2(1)e2}{2(1)e2}
should give 0.4(3)e4
calculating the error in quadrature. Ignoring the uncertainties and giving 0.4e4
is also fine. The problem is that the input numbers contain uncertainties because they are given in a series of macros using the parenthesis form for the errors, and they are not handled correctly by the expl3
module.
Edit: This is a MWE although it does not work at the moment. If a round off parameter of 2
is supplied to the function it should give 5.45
.
\documentclass{article}
\usepackage{siunitx}
\usepackage{expl3}
\newcommand{\a}{6.0(1)e2}
\newcommand{\b}{1.1(1)e2}
\ExplSyntaxOn
\NewDocumentCommand \Func {m m m}
{
\fp_eval:n { round( #1/#2, #3 ) }
}
\ExplSyntaxOff
\begin{document}
\Func{\a}{\b}{2}
\end{document}
0.2(1)
, or whether you get that from a file, or perhaps it's part of a n (expandable) macro. Again, a minimal example (that starts with\documentclass{article}
and ends with\end{document}
). – Werner May 23 '17 at 17:45