[Tex/LaTex] siunitx automatically rounds the values

siunitx

\documentclass[12pt,landscape,a4paper]{report}
\usepackage{amsmath}
\usepackage{siunitx}       % nice alignment for decimals

\begin{document}

\begin{tabular}{
    >{$}c<{$} 
    | S[table-format=-1.4]S[table-format=-1.4] 
    | S[table-format=-2.4]S[table-format=-1.4] 
}
    w_1  &  0.0001 & -0.0001 & -0.0000  & 0.0000  \\
   %w_1  &  0.0001 & -0.0001 & {-}0.0000  & 0.0000  \\
\end{tabular}
\end{document}

How can I ensure that -0.0000 does not lose its negative sign at front?
As I have rounded the values, this minus sign is important.

But siunitx seems to have rounded it too??

Best Answer

You can use the siunitx package for rounding the numbers instead of doing this manually. That way you can enter the original number and setup siunitx to round according to your needs. This allows for a consistent rounding and number formatting throughout the document and allows to easily change the precision if desired. You can find detailed information in the package documentation.

You can specify either a number of decimal places (round-mode=places) or a number of significant figures (round-mode=figures). The number of digits or figures is set using the round-precision option.

\documentclass[12pt,landscape,a4paper]{report}
\usepackage{amsmath}
\usepackage{siunitx}
\sisetup{round-mode=places, round-precision=4}

\begin{document}
\begin{tabular}{
    >{$}c<{$} 
    | S[table-format=-1.4]S[table-format=-1.4] 
    | S[table-format=-2.4]S[table-format=-1.4] 
    }
    w_1   &  0.0001 & -0.0001 & 0.000000001 & -0.000000001  \\
\end{tabular}
\end{document}

output