diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -1,8 +1,10 @@
 # Builds and tests this Haskell project on "GitHub Actions"
 #
-# 2021  Rudy Matela
+# 2021-2023  Rudy Matela
 #
 # some docs: https://github.com/haskell/actions/tree/main/setup
+#
+# The official haskell docker image: https://hub.docker.com/_/haskell
 name: build
 on: [push]
 jobs:
@@ -11,73 +13,82 @@
     steps:
 
       - name: Cache ~/.cabal/packages
-        uses: actions/cache@v2
+        uses: actions/cache@v3
         with:
           path: ~/.cabal/packages
-          key:          v1-${{ runner.os }}-cabal-packages-${{ hashFiles('hello.cabal') }}
+          key:          v1-${{ runner.os }}-cabal-packages-${{ hashFiles('*.cabal') }}
           restore-keys: v1-${{ runner.os }}-cabal-packages-
 
       - name: Cache ~/.cabal and ~/.ghc
-        uses: actions/cache@v2
+        uses: actions/cache@v3
         with:
           path: |
             ~/.cabal
             !~/.cabal/packages
             ~/.ghc
-          key:          v1-${{ runner.os }}-cabal-ghc-latest-${{ hashFiles('hello.cabal') }}
+          key:          v1-${{ runner.os }}-cabal-ghc-latest-${{ hashFiles('*.cabal') }}
           restore-keys: v1-${{ runner.os }}-cabal-ghc-latest-
 
       - run: du -hd3 ~/.cabal ~/.ghc || true
 
+      - run: make --version
+
       - run: haddock --version || sudo apt-get install ghc-haddock
-      - run: ghc   --version
-      - run: cabal --version
+      - run: ghc     --version
+      - run: cabal   --version
+      - run: haddock --version
+      - run: ghc-pkg list
 
       - name: Check out repository
-        uses: actions/checkout@v2
+        uses: actions/checkout@v3
 
-      - run: cabal update
+      - run: git --version
+
       - run: make install-dependencies
 
-      - run: make
-      - run: make test
-      - run: make haddock
+      # 2023-07: some projects were failing with missing base for GHC 9.6.
+      #          Here we compile through cabal only provisionally.
+      # - run: make
+      # - run: make test
+      # - run: make haddock
       - run: make test-sdist
-      - run: make test-via-cabal
+      #- run: make test-via-cabal
+      - run: cabal configure --enable-tests --enable-benchmarks --ghc-options="-O0"
+      - run: cabal build
+      - run: cabal test
+      - run: cabal haddock
 
 
   test-with-ghc:
     strategy:
       matrix:
         ghc:
+          - '9.4'
+          - '9.2'
           - '9.0'
           - '8.10'
-          - '8.8'
           - '8.6'
-          - '8.4'
           - '8.2'
-          - '8.0'
           - '7.10'
-          - '7.8'
     runs-on: ubuntu-latest
     needs: build-and-test
     container: haskell:${{ matrix.ghc }}
     steps:
       - name: Cache ~/.cabal/packages
-        uses: actions/cache@v2
+        uses: actions/cache@v3
         with:
           path: ~/.cabal/packages
-          key:          v1-${{ runner.os }}-cabal-packages-${{ hashFiles('hello.cabal') }}
+          key:          v1-${{ runner.os }}-cabal-packages-${{ hashFiles('*.cabal') }}
           restore-keys: v1-${{ runner.os }}-cabal-packages-
 
       - name: Cache ~/.cabal and ~/.ghc
-        uses: actions/cache@v2
+        uses: actions/cache@v3
         with:
           path: |
             ~/.cabal
             !~/.cabal/packages
             ~/.ghc
-          key:          v1-${{ runner.os }}-cabal-ghc-${{ matrix.ghc }}-${{ hashFiles('hello.cabal') }}
+          key:          v1-${{ runner.os }}-cabal-ghc-${{ matrix.ghc }}-${{ hashFiles('*.cabal') }}
           restore-keys: v1-${{ runner.os }}-cabal-ghc-${{ matrix.ghc }}-
 
       - run: du -hd3 ~/.cabal ~/.ghc || true
@@ -86,13 +97,14 @@
       - run: make --version || apt-get update
       - run: make --version || apt-get install make
 
-      - run: ghc   --version
-      - run: cabal --version
+      - run: ghc     --version
+      - run: cabal   --version
+      - run: haddock --version
+      - run: ghc-pkg list
 
       - name: Check out repository
-        uses: actions/checkout@v2
+        uses: actions/checkout@v3
 
-      - run: cabal update
       - run: make install-dependencies
 
       - run: make
@@ -106,26 +118,29 @@
     needs: build-and-test
     steps:
       - name: Setup Haskell's GHC and Cabal as required by current Stackage LTS
-        uses: haskell/actions/setup@v1
-        with: # lts-17.9
-          ghc-version: '8.10.4'
-          cabal-version: '3.2'
+        uses: haskell/actions/setup@v2
+        with: # lts-19.19
+          ghc-version: '9.0.2'
+          cabal-version: '3.4'
 
-      - uses: actions/cache@v2
+      - uses: actions/cache@v3
         with:
           path: ~/.stack
           key:          v1-${{ runner.os }}-stack-${{ hashFiles('stack.yaml') }}
           restore-keys: v1-${{ runner.os }}-stack-
 
+      - run: stack --version
+
       - name: Check out repository
-        uses: actions/checkout@v2
+        uses: actions/checkout@v3
       - run: make test-via-stack
 
   test-with-hugs:
     runs-on: ubuntu-latest
     needs: build-and-test
     steps:
+      - run: sudo apt-get update
       - run: sudo apt-get install hugs
       - name: Check out repository
-        uses: actions/checkout@v2
+        uses: actions/checkout@v3
       - run: make hugs-test
diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -78,8 +78,8 @@
 [`-%`]: https://hackage.haskell.org/package/percent-format-0.0.1/docs/Text-PercentFormat.html#v:-45--37-
 [`-%%%`]: https://hackage.haskell.org/package/percent-format-0.0.1/docs/Text-PercentFormat.html#v:-45--37--37--37-
 [PercentFormat's TO DO list]: TODO.md
-[stackage-lts-badge]:                 http://stackage.org/package/percent-format/badge/lts
-[stackage-nightly-badge]:             http://stackage.org/package/percent-format/badge/nightly
-[percent-format-on-stackage]:         http://stackage.org/package/percent-format
-[percent-format-on-stackage-lts]:     http://stackage.org/lts/package/percent-format
-[percent-format-on-stackage-nightly]: http://stackage.org/nightly/package/percent-format
+[stackage-lts-badge]:                 https://stackage.org/package/percent-format/badge/lts
+[stackage-nightly-badge]:             https://stackage.org/package/percent-format/badge/nightly
+[percent-format-on-stackage]:         https://stackage.org/package/percent-format
+[percent-format-on-stackage-lts]:     https://stackage.org/lts/package/percent-format
+[percent-format-on-stackage-nightly]: https://stackage.org/nightly/package/percent-format
diff --git a/mk/haskell.mk b/mk/haskell.mk
--- a/mk/haskell.mk
+++ b/mk/haskell.mk
@@ -1,6 +1,6 @@
 # Implicit rules for compiling Haskell code.
 #
-# Copyright (c) 2015-2021 Rudy Matela.
+# Copyright (c) 2015-2023 Rudy Matela.
 # Distributed under the 3-Clause BSD licence.
 #
 # You can optionally configure the "Configuration variables" below in your main
@@ -21,7 +21,7 @@
 GHC ?= ghc
 GHCCMD = $(GHC) -i$(GHCIMPORTDIRS) $(GHCFLAGS)
 HADDOCK ?= haddock
-CABAL_INSTALL = $(shell cabal --version | grep -q "version [0-2]\." && echo 'cabal install' || echo 'cabal v1-install')
+CABAL_INSTALL = $(shell cabal --version | grep -q "version [0-2]\." && echo 'cabal install' || echo 'cabal install --lib')
 
 # Hugs Parameters
 HUGSIMPORTDIRS ?= "/usr/lib/hugs/packages/*"
@@ -90,7 +90,10 @@
 	find $(ALL_HSS) | ./mk/ghcdeps -i$(GHCIMPORTDIRS) $(GHCFLAGS) > $(DEPMK)
 
 install-dependencies:
-	$(CABAL_INSTALL) $(INSTALL_DEPS)
+	if [ -n "$(INSTALL_DEPS)" ]; then \
+		cabal update && \
+		$(CABAL_INSTALL) $(INSTALL_DEPS); \
+	fi
 
 # haddock rules
 haddock: doc/index.html
diff --git a/percent-format.cabal b/percent-format.cabal
--- a/percent-format.cabal
+++ b/percent-format.cabal
@@ -1,7 +1,7 @@
 -- Cabal file for PercentFormat
 
 name:                percent-format
-version:             0.0.2
+version:             0.0.4
 synopsis:            simple printf-style string formatting
 description:
   The @Text.PercentFormat@ library provides printf-style string formatting.  It
@@ -34,15 +34,13 @@
                   , bench/examples.hs
                   , bench/speculate.hs
                   , test/diff/*.out
-tested-with: GHC==9.0
+tested-with: GHC==9.4
+           , GHC==9.2
+           , GHC==9.0
            , GHC==8.10
-           , GHC==8.8
            , GHC==8.6
-           , GHC==8.4
            , GHC==8.2
-           , GHC==8.0
            , GHC==7.10
-           , GHC==7.8
            , Hugs==2006.9
 
 
@@ -53,7 +51,7 @@
 source-repository this
   type:            git
   location:        https://github.com/rudymatela/percent-format
-  tag:             v0.0.2
+  tag:             v0.0.4
 
 library
   exposed-modules: Text.PercentFormat
@@ -69,7 +67,7 @@
   main-is:             number.hs
   other-modules:       Test
   hs-source-dirs:      test
-  build-depends:       base >= 4 && < 5, percent-format, leancheck >= 0.9.2
+  build-depends:       base >= 4 && < 5, percent-format, leancheck >= 1.0.0
   default-language:    Haskell2010
 
 test-suite scientific
@@ -77,7 +75,7 @@
   main-is:             scientific.hs
   other-modules:       Test
   hs-source-dirs:      test
-  build-depends:       base >= 4 && < 5, percent-format, leancheck >= 0.9.2
+  build-depends:       base >= 4 && < 5, percent-format, leancheck >= 1.0.0
   default-language:    Haskell2010
 
 test-suite prop
@@ -85,7 +83,7 @@
   main-is:             prop.hs
   other-modules:       Test
   hs-source-dirs:      test
-  build-depends:       base >= 4 && < 5, percent-format, leancheck >= 0.9.2
+  build-depends:       base >= 4 && < 5, percent-format, leancheck >= 1.0.0
   default-language:    Haskell2010
 
 test-suite quotient
@@ -93,7 +91,7 @@
   main-is:             quotient.hs
   other-modules:       Test
   hs-source-dirs:      test
-  build-depends:       base >= 4 && < 5, percent-format, leancheck >= 0.9.2
+  build-depends:       base >= 4 && < 5, percent-format, leancheck >= 1.0.0
   default-language:    Haskell2010
 
 test-suite unit
@@ -101,7 +99,7 @@
   main-is:             unit.hs
   other-modules:       Test
   hs-source-dirs:      test
-  build-depends:       base >= 4 && < 5, percent-format, leancheck >= 0.9.2
+  build-depends:       base >= 4 && < 5, percent-format, leancheck >= 1.0.0
   default-language:    Haskell2010
 
 test-suite spec
@@ -109,5 +107,5 @@
   main-is:             spec.hs
   other-modules:       Test
   hs-source-dirs:      test
-  build-depends:       base >= 4 && < 5, percent-format, leancheck >= 0.9.2
+  build-depends:       base >= 4 && < 5, percent-format, leancheck >= 1.0.0
   default-language:    Haskell2010
diff --git a/src/Text/PercentFormat.hs b/src/Text/PercentFormat.hs
--- a/src/Text/PercentFormat.hs
+++ b/src/Text/PercentFormat.hs
@@ -348,7 +348,8 @@
           $ q
   where
   capitalize = applyWhen (capitalizeDigits spec) (map toUpper)
-  signal q | q >= 0 = positivePrefix spec
+  signal q | q /= q = positivePrefix spec -- NaN
+           | q >= 0 = positivePrefix spec
            | q <  0 = "-"
   align' :: Quotient -> String -> String
   align' q = if padWith spec == ' '
diff --git a/stack.yaml b/stack.yaml
--- a/stack.yaml
+++ b/stack.yaml
@@ -1,12 +1,8 @@
 # stack file for PercentFormat
-resolver: lts-17.9 # or ghc-8.10.4
+resolver: lts-19.19 # or ghc-9.0.2
 
 packages:
 - .
 
 extra-deps:
-- leancheck-0.9.4
-
-flags: {}
-
-extra-package-dbs: []
+- leancheck-1.0.0
diff --git a/test/diff/examples-+3i.out b/test/diff/examples-+3i.out
--- a/test/diff/examples-+3i.out
+++ b/test/diff/examples-+3i.out
@@ -25,27 +25,27 @@
 "%+3i" -% 0.0          == " +0"
 "%+3i" -% 1.0          == " +1"
 "%+3i" -% (-1.0)       == " -1"
-"%+3i" -% Infinity     == "+Infinity"
 "%+3i" -% 0.5          == " +0"
+"%+3i" -% (-0.5)       == " -0"
 "%+3i" -% 2.0          == " +2"
+"%+3i" -% Infinity     == "+Infinity"
 "%+3i" -% (-Infinity)  == "-Infinity"
-"%+3i" -% (-0.5)       == " -0"
 "%+3i" -% (-2.0)       == " -2"
 "%+3i" -% 0.33333334   == " +0"
-"%+3i" -% 3.0          == " +3"
 "%+3i" -% (-0.33333334) == " -0"
+"%+3i" -% 1.5          == " +2"
 "%+3i" -% (0 % 1)      == " +0"
 "%+3i" -% (1 % 1)      == " +1"
 "%+3i" -% ((-1) % 1)   == " -1"
 "%+3i" -% (1 % 2)      == " +0"
-"%+3i" -% (2 % 1)      == " +2"
 "%+3i" -% ((-1) % 2)   == " -0"
+"%+3i" -% (2 % 1)      == " +2"
 "%+3i" -% ((-2) % 1)   == " -2"
 "%+3i" -% (1 % 3)      == " +0"
-"%+3i" -% (3 % 1)      == " +3"
 "%+3i" -% ((-1) % 3)   == " -0"
-"%+3i" -% ((-3) % 1)   == " -3"
-"%+3i" -% (1 % 4)      == " +0"
+"%+3i" -% (3 % 2)      == " +2"
+"%+3i" -% ((-3) % 2)   == " -2"
+"%+3i" -% (2 % 3)      == " +1"
 "%+3i" -% 'a'          == "!!!"
 "%+3i" -% ' '          == "!!!"
 "%+3i" -% 'b'          == "!!!"
diff --git a/test/diff/examples-+5f.out b/test/diff/examples-+5f.out
--- a/test/diff/examples-+5f.out
+++ b/test/diff/examples-+5f.out
@@ -25,27 +25,27 @@
 "%+5f" -% 0.0          == " +0.0"
 "%+5f" -% 1.0          == " +1.0"
 "%+5f" -% (-1.0)       == " -1.0"
-"%+5f" -% Infinity     == "+Infinity"
 "%+5f" -% 0.5          == " +0.5"
+"%+5f" -% (-0.5)       == " -0.5"
 "%+5f" -% 2.0          == " +2.0"
+"%+5f" -% Infinity     == "+Infinity"
 "%+5f" -% (-Infinity)  == "-Infinity"
-"%+5f" -% (-0.5)       == " -0.5"
 "%+5f" -% (-2.0)       == " -2.0"
 "%+5f" -% 0.33333334   == "+0.33333334"
-"%+5f" -% 3.0          == " +3.0"
 "%+5f" -% (-0.33333334) == "-0.33333334"
+"%+5f" -% 1.5          == " +1.5"
 "%+5f" -% (0 % 1)      == " +0.0"
 "%+5f" -% (1 % 1)      == " +1.0"
 "%+5f" -% ((-1) % 1)   == " -1.0"
 "%+5f" -% (1 % 2)      == " +0.5"
-"%+5f" -% (2 % 1)      == " +2.0"
 "%+5f" -% ((-1) % 2)   == " -0.5"
+"%+5f" -% (2 % 1)      == " +2.0"
 "%+5f" -% ((-2) % 1)   == " -2.0"
 "%+5f" -% (1 % 3)      == "   +0"
-"%+5f" -% (3 % 1)      == " +3.0"
 "%+5f" -% ((-1) % 3)   == "   -0"
-"%+5f" -% ((-3) % 1)   == " -3.0"
-"%+5f" -% (1 % 4)      == "+0.25"
+"%+5f" -% (3 % 2)      == " +1.5"
+"%+5f" -% ((-3) % 2)   == " -1.5"
+"%+5f" -% (2 % 3)      == "   +0"
 "%+5f" -% 'a'          == "!!!!!"
 "%+5f" -% ' '          == "!!!!!"
 "%+5f" -% 'b'          == "!!!!!"
diff --git a/test/diff/examples--11p2f.out b/test/diff/examples--11p2f.out
--- a/test/diff/examples--11p2f.out
+++ b/test/diff/examples--11p2f.out
@@ -25,27 +25,27 @@
 "%-11.2f" -% 0.0          == "0.00       "
 "%-11.2f" -% 1.0          == "1.00       "
 "%-11.2f" -% (-1.0)       == "-1.00      "
-"%-11.2f" -% Infinity     == "Infinity   "
 "%-11.2f" -% 0.5          == "0.50       "
+"%-11.2f" -% (-0.5)       == "-0.50      "
 "%-11.2f" -% 2.0          == "2.00       "
+"%-11.2f" -% Infinity     == "Infinity   "
 "%-11.2f" -% (-Infinity)  == "-Infinity  "
-"%-11.2f" -% (-0.5)       == "-0.50      "
 "%-11.2f" -% (-2.0)       == "-2.00      "
 "%-11.2f" -% 0.33333334   == "0.33       "
-"%-11.2f" -% 3.0          == "3.00       "
 "%-11.2f" -% (-0.33333334) == "-0.33      "
+"%-11.2f" -% 1.5          == "1.50       "
 "%-11.2f" -% (0 % 1)      == "0.00       "
 "%-11.2f" -% (1 % 1)      == "1.00       "
 "%-11.2f" -% ((-1) % 1)   == "-1.00      "
 "%-11.2f" -% (1 % 2)      == "0.50       "
-"%-11.2f" -% (2 % 1)      == "2.00       "
 "%-11.2f" -% ((-1) % 2)   == "-0.50      "
+"%-11.2f" -% (2 % 1)      == "2.00       "
 "%-11.2f" -% ((-2) % 1)   == "-2.00      "
 "%-11.2f" -% (1 % 3)      == "0.33       "
-"%-11.2f" -% (3 % 1)      == "3.00       "
 "%-11.2f" -% ((-1) % 3)   == "-0.33      "
-"%-11.2f" -% ((-3) % 1)   == "-3.00      "
-"%-11.2f" -% (1 % 4)      == "0.25       "
+"%-11.2f" -% (3 % 2)      == "1.50       "
+"%-11.2f" -% ((-3) % 2)   == "-1.50      "
+"%-11.2f" -% (2 % 3)      == "0.67       "
 "%-11.2f" -% 'a'          == "!!!!!!!!!!!"
 "%-11.2f" -% ' '          == "!!!!!!!!!!!"
 "%-11.2f" -% 'b'          == "!!!!!!!!!!!"
diff --git a/test/diff/examples--3i.out b/test/diff/examples--3i.out
--- a/test/diff/examples--3i.out
+++ b/test/diff/examples--3i.out
@@ -25,27 +25,27 @@
 "%-3i" -% 0.0          == "0  "
 "%-3i" -% 1.0          == "1  "
 "%-3i" -% (-1.0)       == "-1 "
-"%-3i" -% Infinity     == "Infinity"
 "%-3i" -% 0.5          == "0  "
+"%-3i" -% (-0.5)       == "-0 "
 "%-3i" -% 2.0          == "2  "
+"%-3i" -% Infinity     == "Infinity"
 "%-3i" -% (-Infinity)  == "-Infinity"
-"%-3i" -% (-0.5)       == "-0 "
 "%-3i" -% (-2.0)       == "-2 "
 "%-3i" -% 0.33333334   == "0  "
-"%-3i" -% 3.0          == "3  "
 "%-3i" -% (-0.33333334) == "-0 "
+"%-3i" -% 1.5          == "2  "
 "%-3i" -% (0 % 1)      == "0  "
 "%-3i" -% (1 % 1)      == "1  "
 "%-3i" -% ((-1) % 1)   == "-1 "
 "%-3i" -% (1 % 2)      == "0  "
-"%-3i" -% (2 % 1)      == "2  "
 "%-3i" -% ((-1) % 2)   == "-0 "
+"%-3i" -% (2 % 1)      == "2  "
 "%-3i" -% ((-2) % 1)   == "-2 "
 "%-3i" -% (1 % 3)      == "0  "
-"%-3i" -% (3 % 1)      == "3  "
 "%-3i" -% ((-1) % 3)   == "-0 "
-"%-3i" -% ((-3) % 1)   == "-3 "
-"%-3i" -% (1 % 4)      == "0  "
+"%-3i" -% (3 % 2)      == "2  "
+"%-3i" -% ((-3) % 2)   == "-2 "
+"%-3i" -% (2 % 3)      == "1  "
 "%-3i" -% 'a'          == "!!!"
 "%-3i" -% ' '          == "!!!"
 "%-3i" -% 'b'          == "!!!"
diff --git a/test/diff/examples--5f.out b/test/diff/examples--5f.out
--- a/test/diff/examples--5f.out
+++ b/test/diff/examples--5f.out
@@ -25,27 +25,27 @@
 "%-5f" -% 0.0          == "0.0  "
 "%-5f" -% 1.0          == "1.0  "
 "%-5f" -% (-1.0)       == "-1.0 "
-"%-5f" -% Infinity     == "Infinity"
 "%-5f" -% 0.5          == "0.5  "
+"%-5f" -% (-0.5)       == "-0.5 "
 "%-5f" -% 2.0          == "2.0  "
+"%-5f" -% Infinity     == "Infinity"
 "%-5f" -% (-Infinity)  == "-Infinity"
-"%-5f" -% (-0.5)       == "-0.5 "
 "%-5f" -% (-2.0)       == "-2.0 "
 "%-5f" -% 0.33333334   == "0.33333334"
-"%-5f" -% 3.0          == "3.0  "
 "%-5f" -% (-0.33333334) == "-0.33333334"
+"%-5f" -% 1.5          == "1.5  "
 "%-5f" -% (0 % 1)      == "0.0  "
 "%-5f" -% (1 % 1)      == "1.0  "
 "%-5f" -% ((-1) % 1)   == "-1.0 "
 "%-5f" -% (1 % 2)      == "0.5  "
-"%-5f" -% (2 % 1)      == "2.0  "
 "%-5f" -% ((-1) % 2)   == "-0.5 "
+"%-5f" -% (2 % 1)      == "2.0  "
 "%-5f" -% ((-2) % 1)   == "-2.0 "
 "%-5f" -% (1 % 3)      == "0    "
-"%-5f" -% (3 % 1)      == "3.0  "
 "%-5f" -% ((-1) % 3)   == "-0   "
-"%-5f" -% ((-3) % 1)   == "-3.0 "
-"%-5f" -% (1 % 4)      == "0.25 "
+"%-5f" -% (3 % 2)      == "1.5  "
+"%-5f" -% ((-3) % 2)   == "-1.5 "
+"%-5f" -% (2 % 3)      == "0    "
 "%-5f" -% 'a'          == "!!!!!"
 "%-5f" -% ' '          == "!!!!!"
 "%-5f" -% 'b'          == "!!!!!"
diff --git a/test/diff/examples--6r.out b/test/diff/examples--6r.out
--- a/test/diff/examples--6r.out
+++ b/test/diff/examples--6r.out
@@ -25,27 +25,27 @@
 "%-6r" -% 0.0          == "0.0   "
 "%-6r" -% 1.0          == "1.0   "
 "%-6r" -% (-1.0)       == "-1.0  "
-"%-6r" -% Infinity     == "Infinity"
 "%-6r" -% 0.5          == "0.5   "
+"%-6r" -% (-0.5)       == "-0.5  "
 "%-6r" -% 2.0          == "2.0   "
+"%-6r" -% Infinity     == "Infinity"
 "%-6r" -% (-Infinity)  == "-Infinity"
-"%-6r" -% (-0.5)       == "-0.5  "
 "%-6r" -% (-2.0)       == "-2.0  "
 "%-6r" -% 0.33333334   == "0.33333334"
-"%-6r" -% 3.0          == "3.0   "
 "%-6r" -% (-0.33333334) == "-0.33333334"
+"%-6r" -% 1.5          == "1.5   "
 "%-6r" -% (0 % 1)      == "0 % 1 "
 "%-6r" -% (1 % 1)      == "1 % 1 "
 "%-6r" -% ((-1) % 1)   == "(-1) % 1"
 "%-6r" -% (1 % 2)      == "1 % 2 "
-"%-6r" -% (2 % 1)      == "2 % 1 "
 "%-6r" -% ((-1) % 2)   == "(-1) % 2"
+"%-6r" -% (2 % 1)      == "2 % 1 "
 "%-6r" -% ((-2) % 1)   == "(-2) % 1"
 "%-6r" -% (1 % 3)      == "1 % 3 "
-"%-6r" -% (3 % 1)      == "3 % 1 "
 "%-6r" -% ((-1) % 3)   == "(-1) % 3"
-"%-6r" -% ((-3) % 1)   == "(-3) % 1"
-"%-6r" -% (1 % 4)      == "1 % 4 "
+"%-6r" -% (3 % 2)      == "3 % 2 "
+"%-6r" -% ((-3) % 2)   == "(-3) % 2"
+"%-6r" -% (2 % 3)      == "2 % 3 "
 "%-6r" -% 'a'          == "'a'   "
 "%-6r" -% ' '          == "' '   "
 "%-6r" -% 'b'          == "'b'   "
diff --git a/test/diff/examples--6s.out b/test/diff/examples--6s.out
--- a/test/diff/examples--6s.out
+++ b/test/diff/examples--6s.out
@@ -25,27 +25,27 @@
 "%-6s" -% 0.0          == "0.0   "
 "%-6s" -% 1.0          == "1.0   "
 "%-6s" -% (-1.0)       == "-1.0  "
-"%-6s" -% Infinity     == "Infinity"
 "%-6s" -% 0.5          == "0.5   "
+"%-6s" -% (-0.5)       == "-0.5  "
 "%-6s" -% 2.0          == "2.0   "
+"%-6s" -% Infinity     == "Infinity"
 "%-6s" -% (-Infinity)  == "-Infinity"
-"%-6s" -% (-0.5)       == "-0.5  "
 "%-6s" -% (-2.0)       == "-2.0  "
 "%-6s" -% 0.33333334   == "0.33333334"
-"%-6s" -% 3.0          == "3.0   "
 "%-6s" -% (-0.33333334) == "-0.33333334"
+"%-6s" -% 1.5          == "1.5   "
 "%-6s" -% (0 % 1)      == "0 % 1 "
 "%-6s" -% (1 % 1)      == "1 % 1 "
 "%-6s" -% ((-1) % 1)   == "(-1) % 1"
 "%-6s" -% (1 % 2)      == "1 % 2 "
-"%-6s" -% (2 % 1)      == "2 % 1 "
 "%-6s" -% ((-1) % 2)   == "(-1) % 2"
+"%-6s" -% (2 % 1)      == "2 % 1 "
 "%-6s" -% ((-2) % 1)   == "(-2) % 1"
 "%-6s" -% (1 % 3)      == "1 % 3 "
-"%-6s" -% (3 % 1)      == "3 % 1 "
 "%-6s" -% ((-1) % 3)   == "(-1) % 3"
-"%-6s" -% ((-3) % 1)   == "(-3) % 1"
-"%-6s" -% (1 % 4)      == "1 % 4 "
+"%-6s" -% (3 % 2)      == "3 % 2 "
+"%-6s" -% ((-3) % 2)   == "(-3) % 2"
+"%-6s" -% (2 % 3)      == "2 % 3 "
 "%-6s" -% 'a'          == "'a'   "
 "%-6s" -% ' '          == "' '   "
 "%-6s" -% 'b'          == "'b'   "
diff --git a/test/diff/examples-03i.out b/test/diff/examples-03i.out
--- a/test/diff/examples-03i.out
+++ b/test/diff/examples-03i.out
@@ -25,27 +25,27 @@
 "%03i" -% 0.0          == "000"
 "%03i" -% 1.0          == "001"
 "%03i" -% (-1.0)       == "-01"
-"%03i" -% Infinity     == "Infinity"
 "%03i" -% 0.5          == "000"
+"%03i" -% (-0.5)       == "-00"
 "%03i" -% 2.0          == "002"
+"%03i" -% Infinity     == "Infinity"
 "%03i" -% (-Infinity)  == "-Infinity"
-"%03i" -% (-0.5)       == "-00"
 "%03i" -% (-2.0)       == "-02"
 "%03i" -% 0.33333334   == "000"
-"%03i" -% 3.0          == "003"
 "%03i" -% (-0.33333334) == "-00"
+"%03i" -% 1.5          == "002"
 "%03i" -% (0 % 1)      == "000"
 "%03i" -% (1 % 1)      == "001"
 "%03i" -% ((-1) % 1)   == "-01"
 "%03i" -% (1 % 2)      == "000"
-"%03i" -% (2 % 1)      == "002"
 "%03i" -% ((-1) % 2)   == "-00"
+"%03i" -% (2 % 1)      == "002"
 "%03i" -% ((-2) % 1)   == "-02"
 "%03i" -% (1 % 3)      == "000"
-"%03i" -% (3 % 1)      == "003"
 "%03i" -% ((-1) % 3)   == "-00"
-"%03i" -% ((-3) % 1)   == "-03"
-"%03i" -% (1 % 4)      == "000"
+"%03i" -% (3 % 2)      == "002"
+"%03i" -% ((-3) % 2)   == "-02"
+"%03i" -% (2 % 3)      == "001"
 "%03i" -% 'a'          == "!!!"
 "%03i" -% ' '          == "!!!"
 "%03i" -% 'b'          == "!!!"
diff --git a/test/diff/examples-11p2f.out b/test/diff/examples-11p2f.out
--- a/test/diff/examples-11p2f.out
+++ b/test/diff/examples-11p2f.out
@@ -25,27 +25,27 @@
 "%11.2f" -% 0.0          == "       0.00"
 "%11.2f" -% 1.0          == "       1.00"
 "%11.2f" -% (-1.0)       == "      -1.00"
-"%11.2f" -% Infinity     == "   Infinity"
 "%11.2f" -% 0.5          == "       0.50"
+"%11.2f" -% (-0.5)       == "      -0.50"
 "%11.2f" -% 2.0          == "       2.00"
+"%11.2f" -% Infinity     == "   Infinity"
 "%11.2f" -% (-Infinity)  == "  -Infinity"
-"%11.2f" -% (-0.5)       == "      -0.50"
 "%11.2f" -% (-2.0)       == "      -2.00"
 "%11.2f" -% 0.33333334   == "       0.33"
-"%11.2f" -% 3.0          == "       3.00"
 "%11.2f" -% (-0.33333334) == "      -0.33"
+"%11.2f" -% 1.5          == "       1.50"
 "%11.2f" -% (0 % 1)      == "       0.00"
 "%11.2f" -% (1 % 1)      == "       1.00"
 "%11.2f" -% ((-1) % 1)   == "      -1.00"
 "%11.2f" -% (1 % 2)      == "       0.50"
-"%11.2f" -% (2 % 1)      == "       2.00"
 "%11.2f" -% ((-1) % 2)   == "      -0.50"
+"%11.2f" -% (2 % 1)      == "       2.00"
 "%11.2f" -% ((-2) % 1)   == "      -2.00"
 "%11.2f" -% (1 % 3)      == "       0.33"
-"%11.2f" -% (3 % 1)      == "       3.00"
 "%11.2f" -% ((-1) % 3)   == "      -0.33"
-"%11.2f" -% ((-3) % 1)   == "      -3.00"
-"%11.2f" -% (1 % 4)      == "       0.25"
+"%11.2f" -% (3 % 2)      == "       1.50"
+"%11.2f" -% ((-3) % 2)   == "      -1.50"
+"%11.2f" -% (2 % 3)      == "       0.67"
 "%11.2f" -% 'a'          == "!!!!!!!!!!!"
 "%11.2f" -% ' '          == "!!!!!!!!!!!"
 "%11.2f" -% 'b'          == "!!!!!!!!!!!"
diff --git a/test/diff/examples-2c.out b/test/diff/examples-2c.out
--- a/test/diff/examples-2c.out
+++ b/test/diff/examples-2c.out
@@ -25,27 +25,27 @@
 "%2c" -% 0.0          == "!!"
 "%2c" -% 1.0          == "!!"
 "%2c" -% (-1.0)       == "!!"
-"%2c" -% Infinity     == "!!"
 "%2c" -% 0.5          == "!!"
+"%2c" -% (-0.5)       == "!!"
 "%2c" -% 2.0          == "!!"
+"%2c" -% Infinity     == "!!"
 "%2c" -% (-Infinity)  == "!!"
-"%2c" -% (-0.5)       == "!!"
 "%2c" -% (-2.0)       == "!!"
 "%2c" -% 0.33333334   == "!!"
-"%2c" -% 3.0          == "!!"
 "%2c" -% (-0.33333334) == "!!"
+"%2c" -% 1.5          == "!!"
 "%2c" -% (0 % 1)      == "!!"
 "%2c" -% (1 % 1)      == "!!"
 "%2c" -% ((-1) % 1)   == "!!"
 "%2c" -% (1 % 2)      == "!!"
-"%2c" -% (2 % 1)      == "!!"
 "%2c" -% ((-1) % 2)   == "!!"
+"%2c" -% (2 % 1)      == "!!"
 "%2c" -% ((-2) % 1)   == "!!"
 "%2c" -% (1 % 3)      == "!!"
-"%2c" -% (3 % 1)      == "!!"
 "%2c" -% ((-1) % 3)   == "!!"
-"%2c" -% ((-3) % 1)   == "!!"
-"%2c" -% (1 % 4)      == "!!"
+"%2c" -% (3 % 2)      == "!!"
+"%2c" -% ((-3) % 2)   == "!!"
+"%2c" -% (2 % 3)      == "!!"
 "%2c" -% 'a'          == " a"
 "%2c" -% ' '          == "  "
 "%2c" -% 'b'          == " b"
diff --git a/test/diff/examples-3i.out b/test/diff/examples-3i.out
--- a/test/diff/examples-3i.out
+++ b/test/diff/examples-3i.out
@@ -25,27 +25,27 @@
 "%3i" -% 0.0          == "  0"
 "%3i" -% 1.0          == "  1"
 "%3i" -% (-1.0)       == " -1"
-"%3i" -% Infinity     == "Infinity"
 "%3i" -% 0.5          == "  0"
+"%3i" -% (-0.5)       == " -0"
 "%3i" -% 2.0          == "  2"
+"%3i" -% Infinity     == "Infinity"
 "%3i" -% (-Infinity)  == "-Infinity"
-"%3i" -% (-0.5)       == " -0"
 "%3i" -% (-2.0)       == " -2"
 "%3i" -% 0.33333334   == "  0"
-"%3i" -% 3.0          == "  3"
 "%3i" -% (-0.33333334) == " -0"
+"%3i" -% 1.5          == "  2"
 "%3i" -% (0 % 1)      == "  0"
 "%3i" -% (1 % 1)      == "  1"
 "%3i" -% ((-1) % 1)   == " -1"
 "%3i" -% (1 % 2)      == "  0"
-"%3i" -% (2 % 1)      == "  2"
 "%3i" -% ((-1) % 2)   == " -0"
+"%3i" -% (2 % 1)      == "  2"
 "%3i" -% ((-2) % 1)   == " -2"
 "%3i" -% (1 % 3)      == "  0"
-"%3i" -% (3 % 1)      == "  3"
 "%3i" -% ((-1) % 3)   == " -0"
-"%3i" -% ((-3) % 1)   == " -3"
-"%3i" -% (1 % 4)      == "  0"
+"%3i" -% (3 % 2)      == "  2"
+"%3i" -% ((-3) % 2)   == " -2"
+"%3i" -% (2 % 3)      == "  1"
 "%3i" -% 'a'          == "!!!"
 "%3i" -% ' '          == "!!!"
 "%3i" -% 'b'          == "!!!"
diff --git a/test/diff/examples-5f.out b/test/diff/examples-5f.out
--- a/test/diff/examples-5f.out
+++ b/test/diff/examples-5f.out
@@ -25,27 +25,27 @@
 "%5f" -% 0.0          == "  0.0"
 "%5f" -% 1.0          == "  1.0"
 "%5f" -% (-1.0)       == " -1.0"
-"%5f" -% Infinity     == "Infinity"
 "%5f" -% 0.5          == "  0.5"
+"%5f" -% (-0.5)       == " -0.5"
 "%5f" -% 2.0          == "  2.0"
+"%5f" -% Infinity     == "Infinity"
 "%5f" -% (-Infinity)  == "-Infinity"
-"%5f" -% (-0.5)       == " -0.5"
 "%5f" -% (-2.0)       == " -2.0"
 "%5f" -% 0.33333334   == "0.33333334"
-"%5f" -% 3.0          == "  3.0"
 "%5f" -% (-0.33333334) == "-0.33333334"
+"%5f" -% 1.5          == "  1.5"
 "%5f" -% (0 % 1)      == "  0.0"
 "%5f" -% (1 % 1)      == "  1.0"
 "%5f" -% ((-1) % 1)   == " -1.0"
 "%5f" -% (1 % 2)      == "  0.5"
-"%5f" -% (2 % 1)      == "  2.0"
 "%5f" -% ((-1) % 2)   == " -0.5"
+"%5f" -% (2 % 1)      == "  2.0"
 "%5f" -% ((-2) % 1)   == " -2.0"
 "%5f" -% (1 % 3)      == "    0"
-"%5f" -% (3 % 1)      == "  3.0"
 "%5f" -% ((-1) % 3)   == "   -0"
-"%5f" -% ((-3) % 1)   == " -3.0"
-"%5f" -% (1 % 4)      == " 0.25"
+"%5f" -% (3 % 2)      == "  1.5"
+"%5f" -% ((-3) % 2)   == " -1.5"
+"%5f" -% (2 % 3)      == "    0"
 "%5f" -% 'a'          == "!!!!!"
 "%5f" -% ' '          == "!!!!!"
 "%5f" -% 'b'          == "!!!!!"
diff --git a/test/diff/examples-6r.out b/test/diff/examples-6r.out
--- a/test/diff/examples-6r.out
+++ b/test/diff/examples-6r.out
@@ -25,27 +25,27 @@
 "%6r" -% 0.0          == "   0.0"
 "%6r" -% 1.0          == "   1.0"
 "%6r" -% (-1.0)       == "  -1.0"
-"%6r" -% Infinity     == "Infinity"
 "%6r" -% 0.5          == "   0.5"
+"%6r" -% (-0.5)       == "  -0.5"
 "%6r" -% 2.0          == "   2.0"
+"%6r" -% Infinity     == "Infinity"
 "%6r" -% (-Infinity)  == "-Infinity"
-"%6r" -% (-0.5)       == "  -0.5"
 "%6r" -% (-2.0)       == "  -2.0"
 "%6r" -% 0.33333334   == "0.33333334"
-"%6r" -% 3.0          == "   3.0"
 "%6r" -% (-0.33333334) == "-0.33333334"
+"%6r" -% 1.5          == "   1.5"
 "%6r" -% (0 % 1)      == " 0 % 1"
 "%6r" -% (1 % 1)      == " 1 % 1"
 "%6r" -% ((-1) % 1)   == "(-1) % 1"
 "%6r" -% (1 % 2)      == " 1 % 2"
-"%6r" -% (2 % 1)      == " 2 % 1"
 "%6r" -% ((-1) % 2)   == "(-1) % 2"
+"%6r" -% (2 % 1)      == " 2 % 1"
 "%6r" -% ((-2) % 1)   == "(-2) % 1"
 "%6r" -% (1 % 3)      == " 1 % 3"
-"%6r" -% (3 % 1)      == " 3 % 1"
 "%6r" -% ((-1) % 3)   == "(-1) % 3"
-"%6r" -% ((-3) % 1)   == "(-3) % 1"
-"%6r" -% (1 % 4)      == " 1 % 4"
+"%6r" -% (3 % 2)      == " 3 % 2"
+"%6r" -% ((-3) % 2)   == "(-3) % 2"
+"%6r" -% (2 % 3)      == " 2 % 3"
 "%6r" -% 'a'          == "   'a'"
 "%6r" -% ' '          == "   ' '"
 "%6r" -% 'b'          == "   'b'"
diff --git a/test/diff/examples-6s.out b/test/diff/examples-6s.out
--- a/test/diff/examples-6s.out
+++ b/test/diff/examples-6s.out
@@ -25,27 +25,27 @@
 "%6s" -% 0.0          == "   0.0"
 "%6s" -% 1.0          == "   1.0"
 "%6s" -% (-1.0)       == "  -1.0"
-"%6s" -% Infinity     == "Infinity"
 "%6s" -% 0.5          == "   0.5"
+"%6s" -% (-0.5)       == "  -0.5"
 "%6s" -% 2.0          == "   2.0"
+"%6s" -% Infinity     == "Infinity"
 "%6s" -% (-Infinity)  == "-Infinity"
-"%6s" -% (-0.5)       == "  -0.5"
 "%6s" -% (-2.0)       == "  -2.0"
 "%6s" -% 0.33333334   == "0.33333334"
-"%6s" -% 3.0          == "   3.0"
 "%6s" -% (-0.33333334) == "-0.33333334"
+"%6s" -% 1.5          == "   1.5"
 "%6s" -% (0 % 1)      == " 0 % 1"
 "%6s" -% (1 % 1)      == " 1 % 1"
 "%6s" -% ((-1) % 1)   == "(-1) % 1"
 "%6s" -% (1 % 2)      == " 1 % 2"
-"%6s" -% (2 % 1)      == " 2 % 1"
 "%6s" -% ((-1) % 2)   == "(-1) % 2"
+"%6s" -% (2 % 1)      == " 2 % 1"
 "%6s" -% ((-2) % 1)   == "(-2) % 1"
 "%6s" -% (1 % 3)      == " 1 % 3"
-"%6s" -% (3 % 1)      == " 3 % 1"
 "%6s" -% ((-1) % 3)   == "(-1) % 3"
-"%6s" -% ((-3) % 1)   == "(-3) % 1"
-"%6s" -% (1 % 4)      == " 1 % 4"
+"%6s" -% (3 % 2)      == " 3 % 2"
+"%6s" -% ((-3) % 2)   == "(-3) % 2"
+"%6s" -% (2 % 3)      == " 2 % 3"
 "%6s" -% 'a'          == "   'a'"
 "%6s" -% ' '          == "   ' '"
 "%6s" -% 'b'          == "   'b'"
diff --git a/test/diff/examples-_3i.out b/test/diff/examples-_3i.out
--- a/test/diff/examples-_3i.out
+++ b/test/diff/examples-_3i.out
@@ -25,27 +25,27 @@
 "% 3i" -% 0.0          == "  0"
 "% 3i" -% 1.0          == "  1"
 "% 3i" -% (-1.0)       == " -1"
-"% 3i" -% Infinity     == " Infinity"
 "% 3i" -% 0.5          == "  0"
+"% 3i" -% (-0.5)       == " -0"
 "% 3i" -% 2.0          == "  2"
+"% 3i" -% Infinity     == " Infinity"
 "% 3i" -% (-Infinity)  == "-Infinity"
-"% 3i" -% (-0.5)       == " -0"
 "% 3i" -% (-2.0)       == " -2"
 "% 3i" -% 0.33333334   == "  0"
-"% 3i" -% 3.0          == "  3"
 "% 3i" -% (-0.33333334) == " -0"
+"% 3i" -% 1.5          == "  2"
 "% 3i" -% (0 % 1)      == "  0"
 "% 3i" -% (1 % 1)      == "  1"
 "% 3i" -% ((-1) % 1)   == " -1"
 "% 3i" -% (1 % 2)      == "  0"
-"% 3i" -% (2 % 1)      == "  2"
 "% 3i" -% ((-1) % 2)   == " -0"
+"% 3i" -% (2 % 1)      == "  2"
 "% 3i" -% ((-2) % 1)   == " -2"
 "% 3i" -% (1 % 3)      == "  0"
-"% 3i" -% (3 % 1)      == "  3"
 "% 3i" -% ((-1) % 3)   == " -0"
-"% 3i" -% ((-3) % 1)   == " -3"
-"% 3i" -% (1 % 4)      == "  0"
+"% 3i" -% (3 % 2)      == "  2"
+"% 3i" -% ((-3) % 2)   == " -2"
+"% 3i" -% (2 % 3)      == "  1"
 "% 3i" -% 'a'          == "!!!"
 "% 3i" -% ' '          == "!!!"
 "% 3i" -% 'b'          == "!!!"
diff --git a/test/diff/examples-abc.out b/test/diff/examples-abc.out
--- a/test/diff/examples-abc.out
+++ b/test/diff/examples-abc.out
@@ -25,27 +25,27 @@
 "abc" -% 0.0          == "abc"
 "abc" -% 1.0          == "abc"
 "abc" -% (-1.0)       == "abc"
-"abc" -% Infinity     == "abc"
 "abc" -% 0.5          == "abc"
+"abc" -% (-0.5)       == "abc"
 "abc" -% 2.0          == "abc"
+"abc" -% Infinity     == "abc"
 "abc" -% (-Infinity)  == "abc"
-"abc" -% (-0.5)       == "abc"
 "abc" -% (-2.0)       == "abc"
 "abc" -% 0.33333334   == "abc"
-"abc" -% 3.0          == "abc"
 "abc" -% (-0.33333334) == "abc"
+"abc" -% 1.5          == "abc"
 "abc" -% (0 % 1)      == "abc"
 "abc" -% (1 % 1)      == "abc"
 "abc" -% ((-1) % 1)   == "abc"
 "abc" -% (1 % 2)      == "abc"
-"abc" -% (2 % 1)      == "abc"
 "abc" -% ((-1) % 2)   == "abc"
+"abc" -% (2 % 1)      == "abc"
 "abc" -% ((-2) % 1)   == "abc"
 "abc" -% (1 % 3)      == "abc"
-"abc" -% (3 % 1)      == "abc"
 "abc" -% ((-1) % 3)   == "abc"
-"abc" -% ((-3) % 1)   == "abc"
-"abc" -% (1 % 4)      == "abc"
+"abc" -% (3 % 2)      == "abc"
+"abc" -% ((-3) % 2)   == "abc"
+"abc" -% (2 % 3)      == "abc"
 "abc" -% 'a'          == "abc"
 "abc" -% ' '          == "abc"
 "abc" -% 'b'          == "abc"
diff --git a/test/diff/examples-c.out b/test/diff/examples-c.out
--- a/test/diff/examples-c.out
+++ b/test/diff/examples-c.out
@@ -25,27 +25,27 @@
 "%c" -% 0.0          == "!"
 "%c" -% 1.0          == "!"
 "%c" -% (-1.0)       == "!"
-"%c" -% Infinity     == "!"
 "%c" -% 0.5          == "!"
+"%c" -% (-0.5)       == "!"
 "%c" -% 2.0          == "!"
+"%c" -% Infinity     == "!"
 "%c" -% (-Infinity)  == "!"
-"%c" -% (-0.5)       == "!"
 "%c" -% (-2.0)       == "!"
 "%c" -% 0.33333334   == "!"
-"%c" -% 3.0          == "!"
 "%c" -% (-0.33333334) == "!"
+"%c" -% 1.5          == "!"
 "%c" -% (0 % 1)      == "!"
 "%c" -% (1 % 1)      == "!"
 "%c" -% ((-1) % 1)   == "!"
 "%c" -% (1 % 2)      == "!"
-"%c" -% (2 % 1)      == "!"
 "%c" -% ((-1) % 2)   == "!"
+"%c" -% (2 % 1)      == "!"
 "%c" -% ((-2) % 1)   == "!"
 "%c" -% (1 % 3)      == "!"
-"%c" -% (3 % 1)      == "!"
 "%c" -% ((-1) % 3)   == "!"
-"%c" -% ((-3) % 1)   == "!"
-"%c" -% (1 % 4)      == "!"
+"%c" -% (3 % 2)      == "!"
+"%c" -% ((-3) % 2)   == "!"
+"%c" -% (2 % 3)      == "!"
 "%c" -% 'a'          == "a"
 "%c" -% ' '          == " "
 "%c" -% 'b'          == "b"
diff --git a/test/diff/examples-f.out b/test/diff/examples-f.out
--- a/test/diff/examples-f.out
+++ b/test/diff/examples-f.out
@@ -25,27 +25,27 @@
 "%f" -% 0.0          == "0.0"
 "%f" -% 1.0          == "1.0"
 "%f" -% (-1.0)       == "-1.0"
-"%f" -% Infinity     == "Infinity"
 "%f" -% 0.5          == "0.5"
+"%f" -% (-0.5)       == "-0.5"
 "%f" -% 2.0          == "2.0"
+"%f" -% Infinity     == "Infinity"
 "%f" -% (-Infinity)  == "-Infinity"
-"%f" -% (-0.5)       == "-0.5"
 "%f" -% (-2.0)       == "-2.0"
 "%f" -% 0.33333334   == "0.33333334"
-"%f" -% 3.0          == "3.0"
 "%f" -% (-0.33333334) == "-0.33333334"
+"%f" -% 1.5          == "1.5"
 "%f" -% (0 % 1)      == "0.0"
 "%f" -% (1 % 1)      == "1.0"
 "%f" -% ((-1) % 1)   == "-1.0"
 "%f" -% (1 % 2)      == "0.5"
-"%f" -% (2 % 1)      == "2.0"
 "%f" -% ((-1) % 2)   == "-0.5"
+"%f" -% (2 % 1)      == "2.0"
 "%f" -% ((-2) % 1)   == "-2.0"
 "%f" -% (1 % 3)      == "0"
-"%f" -% (3 % 1)      == "3.0"
 "%f" -% ((-1) % 3)   == "-0"
-"%f" -% ((-3) % 1)   == "-3.0"
-"%f" -% (1 % 4)      == "0.25"
+"%f" -% (3 % 2)      == "1.5"
+"%f" -% ((-3) % 2)   == "-1.5"
+"%f" -% (2 % 3)      == "0"
 "%f" -% 'a'          == "!"
 "%f" -% ' '          == "!"
 "%f" -% 'b'          == "!"
diff --git a/test/diff/examples-i.out b/test/diff/examples-i.out
--- a/test/diff/examples-i.out
+++ b/test/diff/examples-i.out
@@ -25,27 +25,27 @@
 "%i" -% 0.0          == "0"
 "%i" -% 1.0          == "1"
 "%i" -% (-1.0)       == "-1"
-"%i" -% Infinity     == "Infinity"
 "%i" -% 0.5          == "0"
+"%i" -% (-0.5)       == "-0"
 "%i" -% 2.0          == "2"
+"%i" -% Infinity     == "Infinity"
 "%i" -% (-Infinity)  == "-Infinity"
-"%i" -% (-0.5)       == "-0"
 "%i" -% (-2.0)       == "-2"
 "%i" -% 0.33333334   == "0"
-"%i" -% 3.0          == "3"
 "%i" -% (-0.33333334) == "-0"
+"%i" -% 1.5          == "2"
 "%i" -% (0 % 1)      == "0"
 "%i" -% (1 % 1)      == "1"
 "%i" -% ((-1) % 1)   == "-1"
 "%i" -% (1 % 2)      == "0"
-"%i" -% (2 % 1)      == "2"
 "%i" -% ((-1) % 2)   == "-0"
+"%i" -% (2 % 1)      == "2"
 "%i" -% ((-2) % 1)   == "-2"
 "%i" -% (1 % 3)      == "0"
-"%i" -% (3 % 1)      == "3"
 "%i" -% ((-1) % 3)   == "-0"
-"%i" -% ((-3) % 1)   == "-3"
-"%i" -% (1 % 4)      == "0"
+"%i" -% (3 % 2)      == "2"
+"%i" -% ((-3) % 2)   == "-2"
+"%i" -% (2 % 3)      == "1"
 "%i" -% 'a'          == "!"
 "%i" -% ' '          == "!"
 "%i" -% 'b'          == "!"
diff --git a/test/diff/examples-r.out b/test/diff/examples-r.out
--- a/test/diff/examples-r.out
+++ b/test/diff/examples-r.out
@@ -25,27 +25,27 @@
 "%r" -% 0.0          == "0.0"
 "%r" -% 1.0          == "1.0"
 "%r" -% (-1.0)       == "-1.0"
-"%r" -% Infinity     == "Infinity"
 "%r" -% 0.5          == "0.5"
+"%r" -% (-0.5)       == "-0.5"
 "%r" -% 2.0          == "2.0"
+"%r" -% Infinity     == "Infinity"
 "%r" -% (-Infinity)  == "-Infinity"
-"%r" -% (-0.5)       == "-0.5"
 "%r" -% (-2.0)       == "-2.0"
 "%r" -% 0.33333334   == "0.33333334"
-"%r" -% 3.0          == "3.0"
 "%r" -% (-0.33333334) == "-0.33333334"
+"%r" -% 1.5          == "1.5"
 "%r" -% (0 % 1)      == "0 % 1"
 "%r" -% (1 % 1)      == "1 % 1"
 "%r" -% ((-1) % 1)   == "(-1) % 1"
 "%r" -% (1 % 2)      == "1 % 2"
-"%r" -% (2 % 1)      == "2 % 1"
 "%r" -% ((-1) % 2)   == "(-1) % 2"
+"%r" -% (2 % 1)      == "2 % 1"
 "%r" -% ((-2) % 1)   == "(-2) % 1"
 "%r" -% (1 % 3)      == "1 % 3"
-"%r" -% (3 % 1)      == "3 % 1"
 "%r" -% ((-1) % 3)   == "(-1) % 3"
-"%r" -% ((-3) % 1)   == "(-3) % 1"
-"%r" -% (1 % 4)      == "1 % 4"
+"%r" -% (3 % 2)      == "3 % 2"
+"%r" -% ((-3) % 2)   == "(-3) % 2"
+"%r" -% (2 % 3)      == "2 % 3"
 "%r" -% 'a'          == "'a'"
 "%r" -% ' '          == "' '"
 "%r" -% 'b'          == "'b'"
diff --git a/test/diff/examples-s.out b/test/diff/examples-s.out
--- a/test/diff/examples-s.out
+++ b/test/diff/examples-s.out
@@ -25,27 +25,27 @@
 "%s" -% 0.0          == "0.0"
 "%s" -% 1.0          == "1.0"
 "%s" -% (-1.0)       == "-1.0"
-"%s" -% Infinity     == "Infinity"
 "%s" -% 0.5          == "0.5"
+"%s" -% (-0.5)       == "-0.5"
 "%s" -% 2.0          == "2.0"
+"%s" -% Infinity     == "Infinity"
 "%s" -% (-Infinity)  == "-Infinity"
-"%s" -% (-0.5)       == "-0.5"
 "%s" -% (-2.0)       == "-2.0"
 "%s" -% 0.33333334   == "0.33333334"
-"%s" -% 3.0          == "3.0"
 "%s" -% (-0.33333334) == "-0.33333334"
+"%s" -% 1.5          == "1.5"
 "%s" -% (0 % 1)      == "0 % 1"
 "%s" -% (1 % 1)      == "1 % 1"
 "%s" -% ((-1) % 1)   == "(-1) % 1"
 "%s" -% (1 % 2)      == "1 % 2"
-"%s" -% (2 % 1)      == "2 % 1"
 "%s" -% ((-1) % 2)   == "(-1) % 2"
+"%s" -% (2 % 1)      == "2 % 1"
 "%s" -% ((-2) % 1)   == "(-2) % 1"
 "%s" -% (1 % 3)      == "1 % 3"
-"%s" -% (3 % 1)      == "3 % 1"
 "%s" -% ((-1) % 3)   == "(-1) % 3"
-"%s" -% ((-3) % 1)   == "(-3) % 1"
-"%s" -% (1 % 4)      == "1 % 4"
+"%s" -% (3 % 2)      == "3 % 2"
+"%s" -% ((-3) % 2)   == "(-3) % 2"
+"%s" -% (2 % 3)      == "2 % 3"
 "%s" -% 'a'          == "'a'"
 "%s" -% ' '          == "' '"
 "%s" -% 'b'          == "'b'"
diff --git a/test/diff/examples.out b/test/diff/examples.out
--- a/test/diff/examples.out
+++ b/test/diff/examples.out
@@ -25,27 +25,27 @@
 "%r" -% 0.0          == "0.0"
 "%r" -% 1.0          == "1.0"
 "%r" -% (-1.0)       == "-1.0"
-"%r" -% Infinity     == "Infinity"
 "%r" -% 0.5          == "0.5"
+"%r" -% (-0.5)       == "-0.5"
 "%r" -% 2.0          == "2.0"
+"%r" -% Infinity     == "Infinity"
 "%r" -% (-Infinity)  == "-Infinity"
-"%r" -% (-0.5)       == "-0.5"
 "%r" -% (-2.0)       == "-2.0"
 "%r" -% 0.33333334   == "0.33333334"
-"%r" -% 3.0          == "3.0"
 "%r" -% (-0.33333334) == "-0.33333334"
+"%r" -% 1.5          == "1.5"
 "%r" -% (0 % 1)      == "0 % 1"
 "%r" -% (1 % 1)      == "1 % 1"
 "%r" -% ((-1) % 1)   == "(-1) % 1"
 "%r" -% (1 % 2)      == "1 % 2"
-"%r" -% (2 % 1)      == "2 % 1"
 "%r" -% ((-1) % 2)   == "(-1) % 2"
+"%r" -% (2 % 1)      == "2 % 1"
 "%r" -% ((-2) % 1)   == "(-2) % 1"
 "%r" -% (1 % 3)      == "1 % 3"
-"%r" -% (3 % 1)      == "3 % 1"
 "%r" -% ((-1) % 3)   == "(-1) % 3"
-"%r" -% ((-3) % 1)   == "(-3) % 1"
-"%r" -% (1 % 4)      == "1 % 4"
+"%r" -% (3 % 2)      == "3 % 2"
+"%r" -% ((-3) % 2)   == "(-3) % 2"
+"%r" -% (2 % 3)      == "2 % 3"
 "%r" -% 'a'          == "'a'"
 "%r" -% ' '          == "' '"
 "%r" -% 'b'          == "'b'"
diff --git a/test/sdist b/test/sdist
--- a/test/sdist
+++ b/test/sdist
@@ -2,7 +2,7 @@
 #
 # test/sdist: tests the package generated by "cabal sdist".
 #
-# Copyright (c) 2015-2021 Rudy Matela.
+# Copyright (c) 2015-2023 Rudy Matela.
 # Distributed under the 3-Clause BSD licence.
 
 set -xe
@@ -29,7 +29,11 @@
 tar -tf $pkg | sort --ignore-case --unique > $tmp/ls-cabal-iu
 diff -rud $tmp/ls-cabal-i $tmp/ls-cabal-iu
 
-if [ -d .git ]
+# Check if we have a clone of the repo and git is available
+# The check that we can run git ls-files is needed to avoid:
+# fatal: detected dubious ownership in repository at '/__w/.../hello-haskell'
+# on CI.
+if [ -d .git ] && git --version && git ls-files >/dev/null
 then
 	# Test if files included by cabal are the same as files tracked in git.
 	git ls-files                                         | sort > $tmp/ls-git
