diff --git a/src/iminuit/pdg_format.py b/src/iminuit/pdg_format.py index 1ea93f74..d805ed2f 100644 --- a/src/iminuit/pdg_format.py +++ b/src/iminuit/pdg_format.py @@ -180,6 +180,9 @@ def _strip(items: List[str]) -> List[str]: if i > 0: for k in mask: items[k] = items[k][:-i] + # turn negative zero into positive zero + if items[0] == "-0": + items[0] = "0" return items diff --git a/tests/test_pdg_format.py b/tests/test_pdg_format.py index 26e6e8dc..1e510078 100644 --- a/tests/test_pdg_format.py +++ b/tests/test_pdg_format.py @@ -81,6 +81,8 @@ def test_strip(): assert _strip(["0.11", "0.20"]) == ["0.11", "0.20"] assert _strip(["10.0", "20.0"]) == ["10", "20"] assert _strip(["1.200", "3.40"]) == ["1.20", "3.4"] + assert _strip(["0.000", "0.000"]) == ["0", "0"] + assert _strip(["-0.00", "0.00"]) == ["0", "0"] def test_term_format(): diff --git a/tests/test_tabulate.py b/tests/test_tabulate.py index 7ecd1d8c..42cc4745 100644 --- a/tests/test_tabulate.py +++ b/tests/test_tabulate.py @@ -33,7 +33,7 @@ def test_matrix(): == """ x y -- --- --- -x 1 -0 -y -0 4 +x 1 0 +y 0 4 """ )