summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-10-04 19:53:19 +0000
committerKarl Berry <karl@freefriends.org>2022-10-04 19:53:19 +0000
commitdaadbc9f678b4083698f18584825159c357e0d86 (patch)
tree108226cfc66466ad17024392708deac518a337fb
parent4d5d8538614712dcf9b5cd6dabbfbf144dd55655 (diff)
siunitx (4oct22)
git-svn-id: svn://tug.org/texlive/trunk@64612 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md9
-rw-r--r--Master/texmf-dist/doc/latex/siunitx/siunitx-code.pdfbin617808 -> 617674 bytes
-rw-r--r--Master/texmf-dist/doc/latex/siunitx/siunitx.pdfbin665418 -> 665420 bytes
-rw-r--r--Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx40
-rw-r--r--Master/texmf-dist/source/latex/siunitx/siunitx.dtx2
-rw-r--r--Master/texmf-dist/tex/latex/siunitx/siunitx.sty34
6 files changed, 60 insertions, 25 deletions
diff --git a/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md b/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md
index c4aec21e34a..7cdde2cf789 100644
--- a/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md
+++ b/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md
@@ -7,6 +7,12 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to
## [Unreleased]
+## [v3.1.8] - 2022-10-04
+
+### Fixed
+- Rounding to order of magnitude (see issue
+ [\#622](https://github.com/josephwright/siunitx/issues/622))
+
## [v3.1.7] - 2022-09-07
### Changed
@@ -1811,7 +1817,8 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to
### Added
- First public testing release (as `si`)
-[Unreleased]: https://github.com/josephwright/siunitx/compare/v3.1.7...HEAD
+[Unreleased]: https://github.com/josephwright/siunitx/compare/v3.1.8...HEAD
+[v3.1.8]: https://github.com/josephwright/siunitx/compare/v3.1.7...v3.1.8
[v3.1.7]: https://github.com/josephwright/siunitx/compare/v3.1.6...v3.1.7
[v3.1.6]: https://github.com/josephwright/siunitx/compare/v3.1.5...v3.1.6
[v3.1.5]: https://github.com/josephwright/siunitx/compare/v3.1.4...v3.1.5
diff --git a/Master/texmf-dist/doc/latex/siunitx/siunitx-code.pdf b/Master/texmf-dist/doc/latex/siunitx/siunitx-code.pdf
index c9dcdaecda7..cf6bc8c78c6 100644
--- a/Master/texmf-dist/doc/latex/siunitx/siunitx-code.pdf
+++ b/Master/texmf-dist/doc/latex/siunitx/siunitx-code.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf b/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf
index 4954530a976..15032f99575 100644
--- a/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf
+++ b/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx
index f80684ee9cd..1d11f909f07 100644
--- a/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx
+++ b/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx
@@ -2757,7 +2757,9 @@
% \begin{macrocode}
\cs_new:Npn \@@_round_final_shift:nn #1#2
{
- \str_if_eq:VnTF \l_@@_round_mode_tl { places }
+ \bool_lazy_or:nnTF
+ { \str_if_eq_p:Vn \l_@@_round_mode_tl { figures } }
+ { \str_if_eq_p:Vn \l_@@_round_mode_tl { places } }
{
\use:c
{ @@_round_ \l_@@_exponent_mode_tl :nn }
@@ -2770,7 +2772,11 @@
{
\int_compare:nNnTF { \tl_count:n {#1} } = 4
{
- \@@_round_engineering:NNNNn #1 {#2}
+ \bool_lazy_and:nnTF
+ { \int_compare_p:nNn \l_@@_round_precision_int = 1 }
+ { \str_if_eq_p:Vn \l_@@_round_mode_tl { figures } }
+ { { 1 } { } }
+ { \@@_round_engineering:NNNNn #1 {#2} }
\@@_round_final_shift:Nw 3
}
{ {#1} {#2} }
@@ -2779,7 +2785,7 @@
{
{#1}
\exp_args:NV \@@_round_engineering:nnN
- { \l_@@_round_precision_int } { }
+ \l_@@_round_precision_int { }
#2#3#4#5 \q_recursion_tail \q_recursion_stop
}
\cs_new:Npn \@@_round_engineering:nnN #1#2#3
@@ -2793,11 +2799,17 @@
\cs_new:Npn \@@_round_input:nn #1#2 { {#1} {#2} }
\cs_new:Npn \@@_round_scientific:nn #1#2
{
- \@@_exponent_shift:nnf
- { 1 } {#1} { \@@_round_truncate_direct:n {#2} }
+ \bool_lazy_and:nnTF
+ { \int_compare_p:nNn \l_@@_round_precision_int = 1 }
+ { \str_if_eq_p:Vn \l_@@_round_mode_tl { figures } }
+ { { 1 } { } }
+ {
+ \@@_exponent_shift:nnf
+ { 1 } {#1} { \@@_round_truncate_direct:n {#2} }
+ }
\@@_round_final_shift:Nw 1
}
-\cs_new:Npn \@@_round_final_shift:Nw #1#2 \@@_round_places_end:nnn #3#4#5
+\cs_new:Npn \@@_round_final_shift:Nw #1#2 \@@_round_end:nnn #3#4#5
{
\exp_not:n { {#3} }
\@@_exponent_finalise:n { #4#5 + #1 }
@@ -2885,6 +2897,13 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}[EXP]{\@@_round_end:nnn}
+% Used as a marker to allow adjustment when we pass a power of ten.
+% \begin{macrocode}
+\cs_new:Npn \@@_round_end:nnn #1#2#3 { \exp_not:n { {#1} {#2} {#3} } }
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}[EXP]{\@@_round_figures:nnnnnnn, \@@_round_figures_aux:nnnnnnn}
% \begin{macro}[EXP]{\@@_round_figures_count:nnN}
% \begin{macro}[EXP]{\@@_round_figures_count:nnnN}
@@ -2913,7 +2932,7 @@
\exp_not:n { {#1} {#2} }
\@@_round_figures_count:nnN {#3} {#4} #3#4
\q_recursion_tail \q_recursion_stop
- \exp_not:n { { } {#6} {#7} }
+ \@@_round_end:nnn { } {#6} {#7}
}
{ { } { } { 0 } { } { } { } { 0 } }
}
@@ -2955,7 +2974,6 @@
% \end{macro}
%
% \begin{macro}[EXP]{\@@_round_places:nnnnnnn}
-% \begin{macro}[EXP]{\@@_round_places_end:nnn}
% \begin{macro}[EXP]{\@@_round_places_decimal:nn, \@@_round_places_integer:nn}
% \begin{macro}[EXP]{\@@_round_places_finalise:n}
% \begin{macro}[EXP]{\@@_round_places_finalise:nnnnnnn}
@@ -2977,12 +2995,11 @@
{ \@@_round_places_decimal:nn }
{ \@@_round_places_integer:nn }
{#3} {#4}
- \@@_round_places_end:nnn { } {#6} {#7}
+ \@@_round_end:nnn { } {#6} {#7}
}
}
{ \exp_not:n { {#1} {#2} {#3} {#4} {#5} {#6} {#7} } }
}
-\cs_new:Npn \@@_round_places_end:nnn #1#2#3 { \exp_not:n { {#1} {#2} {#3} } }
\cs_new:Npn \@@_round_places_decimal:nn #1#2
{
\int_compare:nNnTF
@@ -3056,7 +3073,6 @@
% \end{macro}
% \end{macro}
% \end{macro}
-% \end{macro}
%
% \begin{macro}[EXP]{\@@_round_uncertainty:nnnnnnn}
% \begin{macro}[EXP]{\@@_round_uncertainty_end:nn}
@@ -3249,7 +3265,7 @@
\use:c
{ @@_round_ \l_@@_exponent_mode_tl :nn }
{#2} {#3}
- \@@_round_places_end:nnn { { S } { 1 #1 } } {#4} {#5}
+ \@@_round_end:nnn { { S } { 1 #1 } } {#4} {#5}
}
% \end{macrocode}
% With the data available, adjust the output such that the uncertainty
diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx.dtx
index 13a76da695d..3e61bbb85c8 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-09-07} {3.1.7}
+\ProvidesExplPackage {siunitx} {2022-10-04} {3.1.8}
{A comprehensive (SI) units package}
% \end{macrocode}
%
diff --git a/Master/texmf-dist/tex/latex/siunitx/siunitx.sty b/Master/texmf-dist/tex/latex/siunitx/siunitx.sty
index d325f930009..4b86b203300 100644
--- a/Master/texmf-dist/tex/latex/siunitx/siunitx.sty
+++ b/Master/texmf-dist/tex/latex/siunitx/siunitx.sty
@@ -42,7 +42,7 @@
}%
\endinput
}%
-\ProvidesExplPackage {siunitx} {2022-09-07} {3.1.7}
+\ProvidesExplPackage {siunitx} {2022-10-04} {3.1.8}
{A comprehensive (SI) units package}
\msg_new:nnnn { siunitx } { incompatible-package }
{ Package~'#1'~incompatible. }
@@ -3070,7 +3070,9 @@
\cs_generate_variant:Nn \__siunitx_number_round_final:nn { f }
\cs_new:Npn \__siunitx_number_round_final_shift:nn #1#2
{
- \str_if_eq:VnTF \l__siunitx_number_round_mode_tl { places }
+ \bool_lazy_or:nnTF
+ { \str_if_eq_p:Vn \l__siunitx_number_round_mode_tl { figures } }
+ { \str_if_eq_p:Vn \l__siunitx_number_round_mode_tl { places } }
{
\use:c
{ __siunitx_number_round_ \l__siunitx_number_exponent_mode_tl :nn }
@@ -3083,7 +3085,11 @@
{
\int_compare:nNnTF { \tl_count:n {#1} } = 4
{
- \__siunitx_number_round_engineering:NNNNn #1 {#2}
+ \bool_lazy_and:nnTF
+ { \int_compare_p:nNn \l__siunitx_number_round_precision_int = 1 }
+ { \str_if_eq_p:Vn \l__siunitx_number_round_mode_tl { figures } }
+ { { 1 } { } }
+ { \__siunitx_number_round_engineering:NNNNn #1 {#2} }
\__siunitx_number_round_final_shift:Nw 3
}
{ {#1} {#2} }
@@ -3092,7 +3098,7 @@
{
{#1}
\exp_args:NV \__siunitx_number_round_engineering:nnN
- { \l__siunitx_number_round_precision_int } { }
+ \l__siunitx_number_round_precision_int { }
#2#3#4#5 \q_recursion_tail \q_recursion_stop
}
\cs_new:Npn \__siunitx_number_round_engineering:nnN #1#2#3
@@ -3106,11 +3112,17 @@
\cs_new:Npn \__siunitx_number_round_input:nn #1#2 { {#1} {#2} }
\cs_new:Npn \__siunitx_number_round_scientific:nn #1#2
{
- \__siunitx_number_exponent_shift:nnf
- { 1 } {#1} { \__siunitx_number_round_truncate_direct:n {#2} }
+ \bool_lazy_and:nnTF
+ { \int_compare_p:nNn \l__siunitx_number_round_precision_int = 1 }
+ { \str_if_eq_p:Vn \l__siunitx_number_round_mode_tl { figures } }
+ { { 1 } { } }
+ {
+ \__siunitx_number_exponent_shift:nnf
+ { 1 } {#1} { \__siunitx_number_round_truncate_direct:n {#2} }
+ }
\__siunitx_number_round_final_shift:Nw 1
}
-\cs_new:Npn \__siunitx_number_round_final_shift:Nw #1#2 \__siunitx_number_round_places_end:nnn #3#4#5
+\cs_new:Npn \__siunitx_number_round_final_shift:Nw #1#2 \__siunitx_number_round_end:nnn #3#4#5
{
\exp_not:n { {#3} }
\__siunitx_number_exponent_finalise:n { #4#5 + #1 }
@@ -3157,6 +3169,7 @@
{ \prg_replicate:nn {#1} { 0 } }
}
}
+\cs_new:Npn \__siunitx_number_round_end:nnn #1#2#3 { \exp_not:n { {#1} {#2} {#3} } }
\cs_new:Npn \__siunitx_number_round_figures:nnnnnnn #1#2#3#4#5#6#7
{
\bool_lazy_and:nnTF
@@ -3177,7 +3190,7 @@
\exp_not:n { {#1} {#2} }
\__siunitx_number_round_figures_count:nnN {#3} {#4} #3#4
\q_recursion_tail \q_recursion_stop
- \exp_not:n { { } {#6} {#7} }
+ \__siunitx_number_round_end:nnn { } {#6} {#7}
}
{ { } { } { 0 } { } { } { } { 0 } }
}
@@ -3220,12 +3233,11 @@
{ \__siunitx_number_round_places_decimal:nn }
{ \__siunitx_number_round_places_integer:nn }
{#3} {#4}
- \__siunitx_number_round_places_end:nnn { } {#6} {#7}
+ \__siunitx_number_round_end:nnn { } {#6} {#7}
}
}
{ \exp_not:n { {#1} {#2} {#3} {#4} {#5} {#6} {#7} } }
}
-\cs_new:Npn \__siunitx_number_round_places_end:nnn #1#2#3 { \exp_not:n { {#1} {#2} {#3} } }
\cs_new:Npn \__siunitx_number_round_places_decimal:nn #1#2
{
\int_compare:nNnTF
@@ -3419,7 +3431,7 @@
\use:c
{ __siunitx_number_round_ \l__siunitx_number_exponent_mode_tl :nn }
{#2} {#3}
- \__siunitx_number_round_places_end:nnn { { S } { 1 #1 } } {#4} {#5}
+ \__siunitx_number_round_end:nnn { { S } { 1 #1 } } {#4} {#5}
}
\cs_new:Npn \__siunitx_number_round_uncertainty_engineering:nnn #1#2#3
{