Siunitx table decimal places in uncertainty

siunitxtables

I have a table, where values in the second column (B) are expressed as the mean, with the standard deviation in parentheses next to it, in the same column:

\documentclass{article}

\usepackage{siunitx}

\begin{document}

\begin{tabular}{S[table-format=1]S[table-format=4(3.1)]} 
\hline
{A} & {B} \\
\hline
1 & 1176(156.7) \\
2 & 150(20.1) \\
3 & 456(11.1) \\
3 & 24(52.1) \\
\hline
\end{tabular}

\end{document}

When I run this I get: Package siunitx Error: Invalid number '4(3.1)'.

When I change it to table-format=4(3), I get: Package siunitx Error: Invalid number '1176(156.7)'.

When I change the first row to 1176(156), this value prints as expected, but I need the decimal.

When I change the first row to 1176.0(156.1), it is printed as "1176.0(1561)", which is not what I want.

How can I print the mean value as an integer, and the standard deviation in parentheses with the first decimal place?

I am using siunitx 2021-07-26 v3.0.23

Best Answer

This was a bug in siunitx, to be fixed in v3.0.24. For the present, try

\ExplSyntaxOn
\cs_gset_protected:Npn \__siunitx_number_parse_uncert_marker:nNw
  #1#2#3 \q_recursion_tail \q_recursion_stop
  {
    \int_compare:nNnTF { \tl_count:n {#3} - 1 } = { \tl_count:n {#1} }
      {
        \str_if_eq:eeTF
          { \exp_not:V \l__siunitx_number_partial_tl }
          { \prg_replicate:nn { \tl_count:N \l__siunitx_number_partial_tl } { 0 } }
          {
            \__siunitx_number_parse_uncert:NNNN
              #2 \c_false_bool
          }
          {
            \__siunitx_number_parse_uncert:NNNN
              #2 \c_true_bool
          }
            \__siunitx_number_parse_uncert_auxii:NN
      }
      { \exp_after:wN \__siunitx_number_parse_uncert_marker_auxii:nnnN #2 #2 }
    #3 \q_recursion_tail \q_recursion_stop
  }
\cs_new_protected:Npn \__siunitx_number_parse_uncert_marker_auxii:nnnN #1#2#3#4
  {
    \tl_set:Nn #4 { {#1} {#2} { #3 0 } }
    \__siunitx_number_parse_uncert:NNNN #4 \c_true_bool
      \__siunitx_number_parse_uncert_auxii:NN
  }
\ExplSyntaxOff