texlive[64612] Master/texmf-dist: siunitx (4oct22)

commits+karl at tug.org commits+karl at tug.org
Tue Oct 4 21:53:20 CEST 2022


Revision: 64612
          http://tug.org/svn/texlive?view=revision&revision=64612
Author:   karl
Date:     2022-10-04 21:53:19 +0200 (Tue, 04 Oct 2022)
Log Message:
-----------
siunitx (4oct22)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md
    trunk/Master/texmf-dist/doc/latex/siunitx/siunitx-code.pdf
    trunk/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf
    trunk/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx
    trunk/Master/texmf-dist/source/latex/siunitx/siunitx.dtx
    trunk/Master/texmf-dist/tex/latex/siunitx/siunitx.sty

Modified: trunk/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md	2022-10-04 19:52:56 UTC (rev 64611)
+++ trunk/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md	2022-10-04 19:53:19 UTC (rev 64612)
@@ -7,6 +7,12 @@
 
 ## [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 @@
 ### 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

Modified: trunk/Master/texmf-dist/doc/latex/siunitx/siunitx-code.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx	2022-10-04 19:52:56 UTC (rev 64611)
+++ trunk/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx	2022-10-04 19:53:19 UTC (rev 64612)
@@ -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

Modified: trunk/Master/texmf-dist/source/latex/siunitx/siunitx.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/siunitx/siunitx.dtx	2022-10-04 19:52:56 UTC (rev 64611)
+++ trunk/Master/texmf-dist/source/latex/siunitx/siunitx.dtx	2022-10-04 19:53:19 UTC (rev 64612)
@@ -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}
 %

Modified: trunk/Master/texmf-dist/tex/latex/siunitx/siunitx.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/siunitx/siunitx.sty	2022-10-04 19:52:56 UTC (rev 64611)
+++ trunk/Master/texmf-dist/tex/latex/siunitx/siunitx.sty	2022-10-04 19:53:19 UTC (rev 64612)
@@ -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
   {



More information about the tex-live-commits mailing list.