summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-08-08 21:00:04 +0000
committerKarl Berry <karl@freefriends.org>2022-08-08 21:00:04 +0000
commit8ca2c0f2f725360c1d1c530fc5a918bb593da82a (patch)
treed93929134d05f3f3bc0e94bc1cfd4fdb8fafb97a /Master/texmf-dist/source
parentff8099989d5d615f53629c8f491419a183a5982e (diff)
siunitx (8aug22)
git-svn-id: svn://tug.org/texlive/trunk@64080 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r--Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx41
-rw-r--r--Master/texmf-dist/source/latex/siunitx/siunitx.dtx2
2 files changed, 38 insertions, 5 deletions
diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx
index ff97058d20f..e1cb9e639df 100644
--- a/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx
+++ b/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx
@@ -3061,6 +3061,9 @@
% \begin{macro}[EXP]{\@@_round_uncertainty:nnnnnnn}
% \begin{macro}[EXP]{\@@_round_uncertainty_end:nn}
% \begin{macro}[EXP]{\@@_round_uncertainty:nnn}
+% \begin{macro}[EXP]{\@@_round_uncertainty_check:nnnw}
+% \begin{macro}[EXP]{\@@_round_uncertainty_check:Nnnnw}
+% \begin{macro}[EXP]{\@@_round_uncertainty_aux:nnn}
% \begin{macro}[EXP]{\@@_round_uncertainty:nnnn}
% \begin{macro}[EXP]{\@@_round_uncertainty:nnnnn}
% \begin{macro}[EXP]
@@ -3108,11 +3111,35 @@
\cs_new:Npn \@@_round_uncertainty_end:nn #1#2
{ \exp_not:n { {#1} {#2} } }
% \end{macrocode}
+% Before doing any rounding, we need to be sure that the main value has
+% enough significant digits. If not, the result is zero.
+% \begin{macrocode}
+\cs_new:Npn \__siunitx_number_round_uncertainty:nnn #1#2#3
+ {
+ \@@_round_uncertainty_check:nnnw {#1} {#2} {#3}
+ #1#2 \q_recursion_tail \q_recursion_stop
+ }
+\cs_new:Npn \@@_round_uncertainty_check:nnnw #1#2#3#4
+ {
+ \quark_if_recursion_tail_stop_do:Nn #4 { { 0 } { } { } }
+ \int_compare:nNnTF {#4} = 0
+ { \@@_round_uncertainty_check:nnnw }
+ { \@@_round_uncertainty_check:Nnnnw #4 }
+ {#1} {#2} {#3}
+ }
+\cs_new:Npn \@@_round_uncertainty_check:Nnnnw #1#2#3#4#5
+ \q_recursion_tail \q_recursion_stop
+ {
+ \int_compare:nNnTF { \tl_count:n {#1#5} } < { \tl_count:n {#4} }
+ { { 0 } { } { } }
+ { \@@_round_uncertainty_aux:nnn {#2} {#3} {#4} }
+ }
+% \end{macrocode}
% Round the uncertainty first: this is needed to get the number of places
% correct. Once that is done, it's just a question of working out the digits
% in the main part.
% \begin{macrocode}
-\cs_new:Npn \@@_round_uncertainty:nnn #1#2#3
+\cs_new:Npn \@@_round_uncertainty_aux:nnn #1#2#3
{
\exp_args:Nf \@@_round_uncertainty:nnnn
{
@@ -3123,9 +3150,12 @@
}
\cs_new:Npn \@@_round_uncertainty:nnnn #1#2#3#4
{
- \exp_last_unbraced:Nf \@@_round_uncertainty:nnnnn
- { \@@_round:nnn {#1} { } {#4} }
- {#2} {#3} {#1}
+ \use:e
+ {
+ \exp_not:N \@@_round_uncertainty:nnnnn
+ \@@_round:nnn {#1} { } {#4}
+ {#2} {#3} {#1}
+ }
}
% \end{macrocode}
% Here, we need to work out how many digits to zero-fill the uncertainty, for
@@ -3276,6 +3306,9 @@
% \end{macro}
% \end{macro}
% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
%
% \begin{macro}{\@@_zero_decimal:NN}
% \begin{macro}[EXP]{\@@_zero_decimal:nnnnnnn}
diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx.dtx
index 2766ca5ca3d..7dd368799fe 100644
--- a/Master/texmf-dist/source/latex/siunitx/siunitx.dtx
+++ b/Master/texmf-dist/source/latex/siunitx/siunitx.dtx
@@ -121,7 +121,7 @@
%
% Identify the package and give the over all version information.
% \begin{macrocode}
-\ProvidesExplPackage {siunitx} {2022-07-23} {3.1.5}
+\ProvidesExplPackage {siunitx} {2022-08-08} {3.1.6}
{A comprehensive (SI) units package}
% \end{macrocode}
%