summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/siunitx/siunitx-number.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/siunitx/siunitx-number.dtx')
-rw-r--r--macros/latex/contrib/siunitx/siunitx-number.dtx326
1 files changed, 247 insertions, 79 deletions
diff --git a/macros/latex/contrib/siunitx/siunitx-number.dtx b/macros/latex/contrib/siunitx/siunitx-number.dtx
index 8bc0a2dd71..faf216ac67 100644
--- a/macros/latex/contrib/siunitx/siunitx-number.dtx
+++ b/macros/latex/contrib/siunitx/siunitx-number.dtx
@@ -411,6 +411,12 @@
% \end{syntax}
% \end{function}
%
+% \begin{function}{input-uncertainty-divider}
+% \begin{syntax}
+% |input-uncertainty-divider| = \meta{tokens}
+% \end{syntax}
+% \end{function}
+%
% \begin{function}{minimum-decimal-digits}
% \begin{syntax}
% |minimum-decimal-digits| = \meta{min}
@@ -522,6 +528,18 @@
% The standard setting is |false|.
% \end{function}
%
+% \begin{function}{round-direction}
+% \begin{syntax}
+% |round-direction| = |down|\verb"|"|nearest|\verb"|"|up|
+% \end{syntax}
+% Choice which determines how values values are rounded. The setting
+% |up| means that the value is always rounded away from zero, whereas the
+% setting |down| means that the value will be rounded toward zero. The
+% setting |nearest| means that the value will be rounded to the nearest
+% (either up or down), taking account of the setting of |round-half|.
+% The standard setting is |nearest|
+% \end{function}
+%
% \begin{function}{round-half}
% \begin{syntax}
% |round-half| = |even|\verb"|"|up|
@@ -636,6 +654,18 @@
% |full| style is used. The standard setting is |compact|.
% \end{function}
%
+% \begin{function}{uncertainty-round-direction}
+% \begin{syntax}
+% |uncertainty-round-direction| = |down|\verb"|"|nearest|\verb"|"|up|
+% \end{syntax}
+% Choice which determines how uncertainty values are rounded. The setting
+% |up| means that the uncertainty is always rounded away from zero, whereas
+% the setting |down| means that the uncertainty will be rounded toward zero.
+% The setting |nearest| means that the uncertainty will be rounded to the
+% nearest (either up or down), taking account of the setting of |round-half|.
+% The standard setting is |nearest|
+% \end{function}
+%
% \begin{function}{uncertainty-separator}
% \begin{syntax}
% |uncertainty-separator| = \meta{separator}
@@ -776,6 +806,12 @@
% containing an identifier, then zero or more brace groups which contain
% the uncertainty data. In this release, the known uncertainty types are
% \begin{itemize}
+% \item \texttt{A}: An unsymmetrical uncertainty made up of two values.
+% Each is stored as uncertainty in significant digits, with no radix point
+% in the stored value. The two parts are stored within one brace group,
+% within which are two brace groups: the first contains the positive
+% component, the second the negative component. Neither component has a
+% sign.
% \item \texttt{S}: A symmetrical statistical uncertainty made up of
% a single value. These are stored as uncertainty in significant digits,
% with no radix point in the stored value.
@@ -797,6 +833,7 @@
% \l_siunitx_number_input_exponent_tl ,
% \l_@@_input_ignore_tl ,
% \l_@@_input_uncert_open_tl ,
+% \l_@@_input_uncert_divide_tl ,
% \l_siunitx_number_input_sign_tl ,
% \l_@@_input_uncert_sign_tl ,
% \l_@@_explicit_decimal_bool ,
@@ -838,6 +875,8 @@
{ \tl_put_right:Nn \l_siunitx_number_input_sign_tl {##1} }
}
} ,
+ input-uncertainty-divider .tl_set:N =
+ \l_@@_input_uncert_divide_tl ,
parse-numbers .bool_set:N =
\l_siunitx_number_parse_bool ,
retain-explicit-decimal-marker .bool_set:N =
@@ -911,11 +950,21 @@
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{\l_@@_uncert_tl}
+% \begin{variable}
+% {
+% \l_@@_tolerance_tl ,
+% \l_@@_uncert_tl ,
+% \l_@@_uncert_offset_int,
+% \l_@@_uncert_types_tl
+% }
% To allow multiple uncertainties, we want to build this up as possibly
-% multiple entries.
+% multiple entries. For asymmetrical uncertainties/tolerances, we need
+% an additional store.
% \begin{macrocode}
+\tl_new:N \l_@@_tolerance_tl
\tl_new:N \l_@@_uncert_tl
+\int_new:N \l_@@_uncert_offset_int
+\tl_new:N \l_@@_uncert_types_tl
% \end{macrocode}
% \end{variable}
%
@@ -992,6 +1041,7 @@
\group_begin:
\tl_clear:N \l_@@_parsed_tl
\tl_clear:N \l_@@_uncert_tl
+ \tl_clear:N \l_@@_uncert_types_tl
\tl_map_inline:Nn \l_@@_input_ignore_tl
{
\token_if_macro:NT ##1
@@ -1576,7 +1626,6 @@
\cs_new_protected:Npn \@@_parse_loop_main_uncert:NN #1#2
{
\@@_parse_loop_main_store:NNN #1 #2 \c_false_bool
- \tl_clear:N \l_@@_uncert_tl
\@@_parse_uncert:N
}
% \end{macrocode}
@@ -1647,6 +1696,7 @@
{
\tl_clear:N \l_@@_flex_tl
\tl_clear:N \l_@@_parsed_tl
+ \tl_clear:N \l_@@_uncert_tl
}
% \end{macrocode}
% \end{macro}
@@ -1695,14 +1745,21 @@
%
% \begin{macro}{\@@_parse_uncert:N}
% \begin{macro}{\@@_parse_uncert:NNN}
-% \begin{macro}{\@@_parse_uncert_auxi:N, \@@_parse_uncert_auxii:N}
-% \begin{macro}{\@@_parse_uncert_auxii:}
+% \begin{macro}
+% {
+% \@@_parse_uncert_auxi:N ,
+% \@@_parse_uncert_auxii:N ,
+% \@@_parse_uncert_auxiv:N
+% }
+% \begin{macro}{\@@_parse_uncert_auxiv:}
% \begin{macro}{\@@_parse_uncert_marker:}
% \begin{macro}{\@@_parse_uncert_marker:nnn}
% \begin{macro}{\@@_parse_uncert_marker:nnnw}
% \begin{macro}{\@@_parse_uncert_marker:Nnnn}
% \begin{macro}{\@@_parse_uncert_marker:w}
% \begin{macro}{\@@_parse_uncert_marker:nnnnN}
+% \begin{macro}{\@@_parse_uncert_marker:nnnnnN}
+% \begin{macro}{\@@_parse_uncert_marker:nnnnnnN}
% \begin{macro}{\@@_parse_uncert_after:N}
% Parsing a combined uncertainty has a very restricted range of allowed
% tokens. A closing uncertainty token in the first place is an error,
@@ -1754,7 +1811,7 @@
{
\tl_if_in:NnTF \l_siunitx_number_input_decimal_tl {#1}
{ \@@_parse_uncert_marker: }
- { \@@_parse_loop_break:w }
+ { \@@_parse_uncert_auxiv:N #1 }
}
}
\cs_new_protected:Npn \@@_parse_uncert_auxii:N #1
@@ -1764,7 +1821,7 @@
\@@_parse_uncert_auxiii:
\@@_parse_uncert_after:N
}
- { \@@_parse_loop_break:w }
+ { \@@_parse_uncert_auxiv:N #1 }
}
% \end{macrocode}
% Deal with the closing bracket, which might leave us with nothing if there
@@ -1778,6 +1835,24 @@
{ \tl_set:Nn \l_@@_partial_tl { 0 } }
}
% \end{macrocode}
+% A common auxiliary for the case where the token is not a digit, a
+% decimal mark or a closing parenthesis.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_parse_uncert_auxiv:N #1
+ {
+ \tl_if_empty:NTF \l_@@_tolerance_tl
+ {
+ \tl_if_in:NnTF \l_@@_input_uncert_divide_tl {#1}
+ {
+ \cs_set_eq:NN \l_@@_tolerance_tl \l_@@_partial_tl
+ \tl_clear:N \l_@@_partial_tl
+ \@@_parse_uncert:N
+ }
+ { \@@_parse_loop_break:w }
+ }
+ { \@@_parse_loop_break:w }
+ }
+% \end{macrocode}
% Handling a decimal marker in the uncertainty is a bit tricky: we need to make
% sure it's valid. First, we need to be sure that the integer part of the captured
% uncertainty is not too long. Then we need to check that the decimal part is
@@ -1785,7 +1860,7 @@
% Both of these require data from the collected partial number,
% so we extract that first. Checking the decimal part needs the length of the
% not-yet-collected uncertainty. There may be one or more parts to that, so
-% we have to grab p to the \emph{first} closing token to count the length:
+% we have to grab up to the \emph{first} closing token to count the length:
% just grabbing everything only works if there is only a single uncertainty.
% We take protective steps against an entirely-missing closing token so that
% there is not an uncontrolled error.
@@ -1826,22 +1901,62 @@
% With the separated out main part and the current uncertainty part
% available, we can pad the main part if required then restart the
% collection of the uncertainty having thrown away the decimal marker
-% and with the lengths lined up.
+% and with the lengths lined up. To account for asymmetrical
+% uncertainties, there is a bit of work in tracking.
% \begin{macrocode}
\cs_new_protected:Npn \@@_parse_uncert_marker:nnnnN #1#2#3#4#5
{
+ \tl_set:Nx \l_@@_tmp_tl { \tl_head:V \l_@@_input_uncert_divide_tl }
+ \tl_if_empty:NTF \l_@@_tmp_tl
+ { \@@_parse_uncert_marker:nnnnnN {#1} {#2} {#3} {#4} { } #5 }
+ {
+ \use:x
+ {
+ \cs_set_protected:Npn \exp_not:N \@@_parse_uncert_marker:w
+ ####1 \l_@@_tmp_tl ####2 \l_@@_tmp_tl ####3 \exp_not:N \q_stop
+ {
+ \exp_not:N \tl_if_blank:nTF {####2}
+ {
+ \@@_parse_uncert_marker:nnnnnN
+ \exp_not:n { {#1} {#2} {#3} }
+ {####1} { }
+ }
+ {
+ \@@_parse_uncert_marker:nnnnnN
+ \exp_not:n { {#1} {#2} {#3} }
+ {####1} { \l_@@_tmp_tl ####2 }
+ }
+ \exp_not:N #5
+ }
+ \exp_not:N \@@_parse_uncert_marker:w #4
+ \l_@@_tmp_tl \l_@@_tmp_tl \exp_not:N \q_stop
+ }
+ }
+ }
+\cs_new_protected:Npn \@@_parse_uncert_marker:nnnnnN #1#2#3#4#5#6
+ {
+ \exp_args:Ne \@@_parse_uncert_marker:nnnnnnN
+ { \int_eval:n { \tl_count:n {#4} } }
+ {#1} {#2} {#3} {#4} {#5} #6
+ }
+\cs_new_protected:Npn \@@_parse_uncert_marker:nnnnnnN #1#2#3#4#5#6#7
+ {
+ \bool_lazy_and:nnF
+ { \tl_if_empty_p:N \l_@@_tolerance_tl }
+ { \tl_if_empty_p:N \l_@@_uncert_types_tl }
+ {
+ \int_compare:nNnF {#1} = \l_@@_uncert_offset_int
+ { \@@_parse_loop_break:w }
+ }
+ \int_set:Nn \l_@@_uncert_offset_int {#1}
\tl_set:Nx \l_@@_parsed_tl
{
- {#1}
{#2}
+ {#3}
{
- #3
+ #4
\prg_replicate:nn
- {
- \int_max:nn
- { 0 }
- { \tl_count:n {#4} - \tl_count:n {#3} }
- }
+ { \int_max:nn { 0 } { #1 - \tl_count:n {#4} } }
{ 0 }
}
}
@@ -1854,7 +1969,7 @@
\@@_parse_uncert:NNN \c_true_bool
\@@_parse_uncert_auxii:N
}
- #4#5
+ #5#6#7
}
% \end{macrocode}
% At the end of collection, we can either start another one or be done:
@@ -1866,9 +1981,26 @@
{
\exp_not:V \l_@@_uncert_tl
\tl_if_empty:NF \l_@@_partial_tl
- { { \exp_not:V \l_@@_partial_tl } }
+ {
+ {
+ \tl_if_empty:NTF \l_@@_tolerance_tl
+ { \exp_not:V \l_@@_partial_tl }
+ {
+ { \exp_not:V \l_@@_tolerance_tl }
+ { \exp_not:V \l_@@_partial_tl }
+ }
+ }
+ }
+ }
+ \tl_set:Nx \l_@@_uncert_types_tl
+ {
+ \l_@@_uncert_types_tl
+ \tl_if_empty:NTF \l_@@_tolerance_tl
+ { S }
+ { A }
}
\tl_clear:N \l_@@_partial_tl
+ \tl_clear:N \l_@@_tolerance_tl
\quark_if_recursion_tail_stop_do:Nn #1
{
\tl_set:Nx \l_@@_parsed_tl
@@ -1877,17 +2009,14 @@
{
\tl_if_empty:NF \l_@@_uncert_tl
{
- {
- \prg_replicate:nn
- { \tl_count:N \l_@@_uncert_tl }
- { S }
- }
+ { \l_@@_uncert_types_tl }
\exp_not:V \l_@@_uncert_tl
}
}
}
\tl_clear:N \l_@@_partial_tl
\tl_clear:N \l_@@_uncert_tl
+ \int_zero:N \l_@@_uncert_offset_int
}
\tl_if_in:NnTF \l_@@_input_uncert_open_tl {#1}
{ \@@_parse_uncert:N }
@@ -1905,6 +2034,8 @@
% \end{macro}
% \end{macro}
% \end{macro}
+% \end{macro}
+% \end{macro}
%
% \subsection{Processing numbers}
%
@@ -1917,11 +2048,13 @@
% \l_@@_exponent_fixed_int ,
% \l_@@_min_decimal_int ,
% \l_@@_min_integer_int ,
+% \l_@@_round_dir_tl ,
% \l_@@_round_half_even_bool ,
% \l_@@_round_mode_tl ,
% \l_@@_round_pad_bool ,
% \l_@@_round_precision_int ,
-% \l_@@_round_positive_bool
+% \l_@@_round_positive_bool ,
+% \l_@@_round_uncert_dir_tl
% }
% \begin{macrocode}
\keys_define:nn { siunitx }
@@ -1943,6 +2076,9 @@
\l_@@_min_decimal_int ,
minimum-integer-digits .int_set:N =
\l_@@_min_integer_int ,
+ round-direction .choices:nn =
+ { down , nearest , up }
+ { \tl_set_eq:NN \l_@@_round_dir_tl \l_keys_choice_tl } ,
round-half .choice: ,
round-half / even .code:n =
{ \bool_set_true:N \l_@@_round_half_even_bool } ,
@@ -1958,11 +2094,16 @@
round-precision .int_set:N =
\l_@@_round_precision_int ,
round-zero-positive .bool_set:N =
- \l_@@_round_positive_bool
+ \l_@@_round_positive_bool ,
+ uncertainty-round-direction .choices:nn =
+ { down , nearest , up }
+ { \tl_set_eq:NN \l_@@_round_uncert_dir_tl \l_keys_choice_tl } ,
}
\bool_new:N \l_@@_round_half_even_bool
\tl_new:N \l_@@_exponent_mode_tl
+\tl_new:N \l_@@_round_dir_tl
\tl_new:N \l_@@_round_mode_tl
+\tl_new:N \l_@@_round_uncert_dir_tl
% \end{macrocode}
% \end{variable}
%
@@ -2611,15 +2752,16 @@
% \end{macro}
%
% \begin{macro}[EXP]{\@@_round:nnn, \@@_round:fnn}
+% \begin{macro}[EXP]{\@@_round:nnnn, \@@_round:Vnnn}
% \begin{macro}[EXP]
% {
-% \@@_round_auxi:nnnN ,
-% \@@_round_auxii:nnnN ,
-% \@@_round_auxiii:nnnN
+% \@@_round_auxi:nnnnN ,
+% \@@_round_auxii:nnnnN ,
+% \@@_round_auxiii:nnnnN ,
+% \@@_round_auxiv:nnnnN
% }
-% \begin{macro}[EXP]{\@@_round_auxiv:nnN, \@@_round_auxv:nnN}
-% \begin{macro}[EXP]{\@@_round_auxvi:nN}
-% \begin{macro}[EXP]{\@@_round_auxvii:nnTF}
+% \begin{macro}[EXP]{\@@_round_auxv:nnnN, \@@_round_auxvi:nnnN}
+% \begin{macro}[EXP]{\@@_round_auxvii:nnnTF}
% \begin{macro}[EXP]{\@@_round_auxviii:nnN, \@@_round_auxix:nnN}
% \begin{macro}[EXP]{\@@_round_final_integer:nnw, \@@_round_final_decimal:nnw}
% \begin{macro}[EXP]{\@@_round_final_signicant:n}
@@ -2648,34 +2790,40 @@
% \begin{macrocode}
\cs_new:Npn \@@_round:nnn #1#2#3
{
- \@@_round_auxi:nnnN {#1} {#2} { }
- #3 \q_recursion_tail \q_recursion_stop
+ \@@_round:Vnnn \l_@@_round_dir_tl
+ {#1} {#2} {#3}
}
\cs_generate_variant:Nn \@@_round:nnn { f }
-\cs_new:Npn \@@_round_auxi:nnnN #1#2#3#4
+\cs_new:Npn \@@_round:nnnn #1#2#3#4
{
- \quark_if_recursion_tail_stop_do:Nn #4
+ \@@_round_auxi:nnnnN {#1} {#2} {#3} { }
+ #4 \q_recursion_tail \q_recursion_stop
+ }
+\cs_generate_variant:Nn \@@_round:nnnn { V }
+\cs_new:Npn \@@_round_auxi:nnnnN #1#2#3#4#5
+ {
+ \quark_if_recursion_tail_stop_do:Nn #5
{
- \@@_round_auxii:nnnN {#1} {#3} { } #2
+ \@@_round_auxii:nnnnN {#1} {#2} {#4} { } #3
\q_recursion_tail \q_recursion_stop
}
- \@@_round_auxi:nnnN {#1} {#2} {#4#3}
+ \@@_round_auxi:nnnnN {#1} {#2} {#3} {#5#4}
}
-\cs_new:Npn \@@_round_auxii:nnnN #1#2#3#4
+\cs_new:Npn \@@_round_auxii:nnnnN #1#2#3#4#5
{
- \quark_if_recursion_tail_stop_do:Nn #4
+ \quark_if_recursion_tail_stop_do:Nn #5
{
- \tl_if_blank:nTF {#2}
+ \tl_if_blank:nTF {#3}
{
- \@@_round_auxiv:nnnN {#1} { } { } #3
+ \@@_round_auxiv:nnnnN {#2} {#1} { } { } #4
\q_recursion_tail \q_recursion_stop
}
{
- \@@_round_auxiii:nnnN {#1} {#3} { } #2
+ \@@_round_auxiii:nnnnN {#2} {#1} {#4} { } #3
\q_recursion_tail \q_recursion_stop
}
}
- \@@_round_auxii:nnnN {#1} {#2} {#4#3}
+ \@@_round_auxii:nnnnN {#1} {#2} {#3} {#5#4}
}
% \end{macrocode}
% We now have the input reversed plus how many digits we need to discard
@@ -2688,74 +2836,87 @@
% of the integer: that may product a value of $1\dots$: we tidy up the
% case where it comes out as $0$ later.
% \begin{macrocode}
-\cs_new:Npn \@@_round_auxiii:nnnN #1#2#3#4
+\cs_new:Npn \@@_round_auxiii:nnnnN #1#2#3#4#5
{
- \quark_if_recursion_tail_stop_do:Nn #4
+ \quark_if_recursion_tail_stop_do:Nn #5
{
- \@@_round_auxiv:nnnN {#1} { } {#3} #2
+ \@@_round_auxiv:nnnnN {#1} {#2} { } {#4} #3
\q_recursion_tail \q_recursion_stop
}
\int_compare:nNnTF {#1} > 0
{
- \exp_args:Nf \@@_round_auxiii:nnnN
- { \int_eval:n { #1 - 1 } } {#2} { #4#3 }
+ \exp_args:Nf \@@_round_auxiii:nnnnN
+ { \int_eval:n { #1 - 1 } } {#2} {#3} { #5#4 }
}
- { \@@_round_auxv:nnN {#3} {#2} #4 }
+ { \@@_round_auxv:nnnN {#2} {#4} {#3} #5 }
}
-\cs_new:Npn \@@_round_auxiv:nnnN #1#2#3#4
+\cs_new:Npn \@@_round_auxiv:nnnnN #1#2#3#4#5
{
- \quark_if_recursion_tail_stop_do:Nn #4
+ \quark_if_recursion_tail_stop_do:Nn #5
{
\int_compare:nNnTF {#1} = 0
{
- \@@_round_auxvi:nnN {#3} {#2}
+ \@@_round_auxvi:nnnN {#2} {#4} {#3}
0 \q_recursion_tail \q_recursion_stop
}
{ { 0 } { } }
}
\int_compare:nNnTF {#1} > 0
{
- \exp_args:Nf \@@_round_auxiv:nnnN
- { \int_eval:n { #1 - 1 } } { #2 0 } { #4#3 }
+ \exp_args:Nf \@@_round_auxiv:nnnnN
+ { \int_eval:n { #1 - 1 } } {#2} { #3 0 } { #5#4 }
}
- { \@@_round_auxvi:nnN {#3} {#2} #4 }
+ { \@@_round_auxvi:nnnN {#2} {#4} {#3} #5 }
}
% \end{macrocode}
-% The lead off to rounding proper needs to deal with the half-even rule:
-% it can only apply at this stage, when the \emph{discarded} value can
-% be exactly half.
+% We now have the discarded digits, the matching filler and the
+% next digit. So we can make the decision on rounding: that
+% is handled by a common auxiliary.
% \begin{macrocode}
-\cs_new:Npn \@@_round_auxv:nnN #1#2#3
+\cs_new:Npn \@@_round_auxv:nnnN #1#2#3#4
{
- \quark_if_recursion_tail_stop_do:Nn #3
+ \quark_if_recursion_tail_stop_do:Nn #4
{
- \@@_round_auxvi:nnN
- {#1} { } #2 \q_recursion_tail \q_recursion_stop
+ \@@_round_auxvi:nnnN
+ {#1} {#2} { } #3 \q_recursion_tail \q_recursion_stop
}
- \@@_round_auxvii:nnTF {#1} {#3}
+ \@@_round_auxvii:nnnTF {#1} {#2} {#4}
{ \@@_round_final_decimal:nnw }
{ \@@_round_auxviii:nnN }
- {#2} { } #3
+ {#3} { } #4
}
-\cs_new:Npn \@@_round_auxvi:nnN #1#2#3
+\cs_new:Npn \@@_round_auxvi:nnnN #1#2#3#4
{
- \quark_if_recursion_tail_stop_do:Nn #3
+ \quark_if_recursion_tail_stop_do:Nn #4
{ { 0 } { } }
- \@@_round_auxvii:nnTF {#1} {#3}
+ \@@_round_auxvii:nnnTF {#1} {#2} {#4}
{ \@@_round_final_integer:nnw }
{ \@@_round_auxix:nnN }
- { } {#2} #3
+ { } {#3} #4
}
-\cs_new:Npn \@@_round_auxvii:nnTF #1#2
+% \end{macrocode}
+% For rounding up or down, the decision here is easy: pick the appropriate
+% branch. For rounding to nearest, we need to deal with the half-even rule:
+% it can only apply at this stage, when the \emph{discarded} value can
+% be exactly half.
+% \begin{macrocode}
+\cs_new:Npn \@@_round_auxvii:nnnTF #1#2#3
{
- \bool_lazy_or:nnTF
- { \int_compare_p:nNn { 0 \tl_head:n {#1} } < 5 }
+ \str_case:nnF {#1}
+ {
+ { down } { \use_i:nn }
+ { up } { \use_ii:nn }
+ }
{
- \bool_lazy_all_p:n
+ \bool_lazy_or:nnTF
+ { \int_compare_p:nNn { 0 \tl_head:n {#2} } < 5 }
{
- { \l_@@_round_half_even_bool }
- { ! \int_if_odd_p:n {#2} }
- { \@@_round_if_half_p:n {#1} }
+ \bool_lazy_all_p:n
+ {
+ { \l_@@_round_half_even_bool }
+ { ! \int_if_odd_p:n {#3} }
+ { \@@_round_if_half_p:n {#2} }
+ }
}
}
}
@@ -3271,8 +3432,9 @@
\use:e
{
\exp_not:N \@@_round_uncertainty:nnnnnn
- \@@_round:nnn {#1} { } {#4}
- {#2} {#3} {#1} {#4}
+ \@@_round:Vnnn
+ \l_@@_round_uncert_dir_tl {#1} { } {#4}
+ {#2} {#3} {#1} {#4}
}
}
% \end{macrocode}
@@ -4240,6 +4402,7 @@
\@@_output_uncert_A:nnnn
\cs_new:Npx \@@_output_uncert_A:nnnnn #1#2#3#4#5
{
+ { }
^
{
+
@@ -4631,6 +4794,7 @@
retain-explicit-plus = false ,
retain-negative-zero = false ,
retain-zero-uncertainty = false ,
+ round-direction = nearest ,
round-half = up ,
round-minimum = 0 ,
round-mode = none ,
@@ -4642,15 +4806,19 @@
uncertainty-descriptor-separator = \ ,
uncertainty-descriptors = ,
uncertainty-mode = compact ,
+ uncertainty-round-direction = nearest ,
uncertainty-separator = ,
zero-decimal-as-symbol = false ,
zero-symbol = \mbox { --- }
}
% \end{macrocode}
-% One awkward setting.
+% Two awkward settings.
% \begin{macrocode}
\keys_set:nx { siunitx }
- { exponent-thresholds = -3 \c_colon_str 3 }
+ {
+ exponent-thresholds = -3 \c_colon_str 3 ,
+ input-uncertainty-divider = \c_colon_str
+ }
% \end{macrocode}
%
% \begin{macrocode}