Skip to content

Commit

Permalink
Fix printing "1" when "print-unity-mantissa = false"
Browse files Browse the repository at this point in the history
Fixes #700.
  • Loading branch information
josephwright committed Nov 6, 2023
1 parent c97ebfb commit 2e3d950
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to
- `\siunitx_declare_unit:Nx`
- `\siunitx_declare_unit:Nxn`

### Fixed
- Printing of `1` when `print-unity-mantissa = false` (see issue
[\#700](https://github.com/josephwright/siunitx/issues/700))

## [v3.3.7] - 2023-10-07

### Fixed
Expand Down
6 changes: 5 additions & 1 deletion siunitx-number.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -4148,7 +4148,11 @@
{ ! \str_if_eq_p:nn { #1 . #2 } { 1. } }
{
\bool_lazy_and_p:nn
{ \str_if_eq_p:nn {#3} { 0 } }
{
\bool_lazy_or_p:nn
{ \tl_if_blank_p:n {#3} }
{ \str_if_eq_p:nn {#3} { 0 } }
}
{ ! \l_@@_zero_exponent_bool }
}
{
Expand Down
3 changes: 3 additions & 0 deletions testfiles/siunitx-number.lvt
Original file line number Diff line number Diff line change
Expand Up @@ -705,12 +705,15 @@
{
\test:n { 1e10 }
\test:n { 1e0 }
\test:n { 1 }
\keys_set:nn { siunitx } { print-unity-mantissa = true }
\test:n { 1e10 }
\test:n { 1e0 }
\test:n { 1 }
\keys_set:nn { siunitx } { print-unity-mantissa = false }
\test:n { 1e10 }
\test:n { 1e0 }
\test:n { 1 }
}

\TEST { Option~setting~"print-zero-exponent" }
Expand Down
9 changes: 9 additions & 0 deletions testfiles/siunitx-number.tlg
Original file line number Diff line number Diff line change
Expand Up @@ -1641,18 +1641,27 @@ l. ... }
> \l_tmpa_tl=1.
<recently read> }
l. ... }
> \l_tmpa_tl=1.
<recently read> }
l. ... }
> \l_tmpa_tl=1\times 10^{10}.
<recently read> }
l. ... }
> \l_tmpa_tl=1.
<recently read> }
l. ... }
> \l_tmpa_tl=1.
<recently read> }
l. ... }
> \l_tmpa_tl=10^{10}.
<recently read> }
l. ... }
> \l_tmpa_tl=1.
<recently read> }
l. ... }
> \l_tmpa_tl=1.
<recently read> }
l. ... }
============================================================
============================================================
TEST 53: Option setting "print-zero-exponent"
Expand Down

0 comments on commit 2e3d950

Please sign in to comment.