Average Error: 12.7 → 11.8
Time: 16.5s
Precision: 64
\[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\]
\[\begin{array}{l} \mathbf{if}\;b \le -3.382258806001056297221939326237757014037 \cdot 10^{-116}:\\ \;\;\;\;\left(\left(x \cdot z\right) \cdot y + \left(-a \cdot \left(x \cdot t\right)\right)\right) + \mathsf{fma}\left(b, t \cdot i - c \cdot z, a \cdot \left(j \cdot c\right) + \left(-y \cdot i\right) \cdot j\right)\\ \mathbf{elif}\;b \le 1.627404838648705499216592053613665466888 \cdot 10^{-212}:\\ \;\;\;\;x \cdot \left(y \cdot z - t \cdot a\right) + \left(c \cdot \left(a \cdot j - z \cdot b\right) - \left(y \cdot i\right) \cdot j\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot \left(z \cdot y\right) + \left(-a \cdot \left(x \cdot t\right)\right)\right) + \mathsf{fma}\left(b, t \cdot i - c \cdot z, a \cdot \left(j \cdot c\right) + y \cdot \left(-i \cdot j\right)\right)\\ \end{array}\]
\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)
\begin{array}{l}
\mathbf{if}\;b \le -3.382258806001056297221939326237757014037 \cdot 10^{-116}:\\
\;\;\;\;\left(\left(x \cdot z\right) \cdot y + \left(-a \cdot \left(x \cdot t\right)\right)\right) + \mathsf{fma}\left(b, t \cdot i - c \cdot z, a \cdot \left(j \cdot c\right) + \left(-y \cdot i\right) \cdot j\right)\\

\mathbf{elif}\;b \le 1.627404838648705499216592053613665466888 \cdot 10^{-212}:\\
\;\;\;\;x \cdot \left(y \cdot z - t \cdot a\right) + \left(c \cdot \left(a \cdot j - z \cdot b\right) - \left(y \cdot i\right) \cdot j\right)\\

\mathbf{else}:\\
\;\;\;\;\left(x \cdot \left(z \cdot y\right) + \left(-a \cdot \left(x \cdot t\right)\right)\right) + \mathsf{fma}\left(b, t \cdot i - c \cdot z, a \cdot \left(j \cdot c\right) + y \cdot \left(-i \cdot j\right)\right)\\

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r1094768 = x;
        double r1094769 = y;
        double r1094770 = z;
        double r1094771 = r1094769 * r1094770;
        double r1094772 = t;
        double r1094773 = a;
        double r1094774 = r1094772 * r1094773;
        double r1094775 = r1094771 - r1094774;
        double r1094776 = r1094768 * r1094775;
        double r1094777 = b;
        double r1094778 = c;
        double r1094779 = r1094778 * r1094770;
        double r1094780 = i;
        double r1094781 = r1094772 * r1094780;
        double r1094782 = r1094779 - r1094781;
        double r1094783 = r1094777 * r1094782;
        double r1094784 = r1094776 - r1094783;
        double r1094785 = j;
        double r1094786 = r1094778 * r1094773;
        double r1094787 = r1094769 * r1094780;
        double r1094788 = r1094786 - r1094787;
        double r1094789 = r1094785 * r1094788;
        double r1094790 = r1094784 + r1094789;
        return r1094790;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r1094791 = b;
        double r1094792 = -3.3822588060010563e-116;
        bool r1094793 = r1094791 <= r1094792;
        double r1094794 = x;
        double r1094795 = z;
        double r1094796 = r1094794 * r1094795;
        double r1094797 = y;
        double r1094798 = r1094796 * r1094797;
        double r1094799 = a;
        double r1094800 = t;
        double r1094801 = r1094794 * r1094800;
        double r1094802 = r1094799 * r1094801;
        double r1094803 = -r1094802;
        double r1094804 = r1094798 + r1094803;
        double r1094805 = i;
        double r1094806 = r1094800 * r1094805;
        double r1094807 = c;
        double r1094808 = r1094807 * r1094795;
        double r1094809 = r1094806 - r1094808;
        double r1094810 = j;
        double r1094811 = r1094810 * r1094807;
        double r1094812 = r1094799 * r1094811;
        double r1094813 = r1094797 * r1094805;
        double r1094814 = -r1094813;
        double r1094815 = r1094814 * r1094810;
        double r1094816 = r1094812 + r1094815;
        double r1094817 = fma(r1094791, r1094809, r1094816);
        double r1094818 = r1094804 + r1094817;
        double r1094819 = 1.6274048386487055e-212;
        bool r1094820 = r1094791 <= r1094819;
        double r1094821 = r1094797 * r1094795;
        double r1094822 = r1094800 * r1094799;
        double r1094823 = r1094821 - r1094822;
        double r1094824 = r1094794 * r1094823;
        double r1094825 = r1094799 * r1094810;
        double r1094826 = r1094795 * r1094791;
        double r1094827 = r1094825 - r1094826;
        double r1094828 = r1094807 * r1094827;
        double r1094829 = r1094813 * r1094810;
        double r1094830 = r1094828 - r1094829;
        double r1094831 = r1094824 + r1094830;
        double r1094832 = r1094795 * r1094797;
        double r1094833 = r1094794 * r1094832;
        double r1094834 = r1094833 + r1094803;
        double r1094835 = r1094805 * r1094810;
        double r1094836 = -r1094835;
        double r1094837 = r1094797 * r1094836;
        double r1094838 = r1094812 + r1094837;
        double r1094839 = fma(r1094791, r1094809, r1094838);
        double r1094840 = r1094834 + r1094839;
        double r1094841 = r1094820 ? r1094831 : r1094840;
        double r1094842 = r1094793 ? r1094818 : r1094841;
        return r1094842;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus i

Bits error versus j

Target

Original12.7
Target20.4
Herbie11.8
\[\begin{array}{l} \mathbf{if}\;x \lt -1.469694296777705016266218530347997287942 \cdot 10^{-64}:\\ \;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - \frac{b \cdot \left({\left(c \cdot z\right)}^{2} - {\left(t \cdot i\right)}^{2}\right)}{c \cdot z + t \cdot i}\right) + j \cdot \left(c \cdot a - y \cdot i\right)\\ \mathbf{elif}\;x \lt 3.21135273622268028942701600607048800714 \cdot 10^{-147}:\\ \;\;\;\;\left(b \cdot i - x \cdot a\right) \cdot t - \left(z \cdot \left(c \cdot b\right) - j \cdot \left(c \cdot a - y \cdot i\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - \frac{b \cdot \left({\left(c \cdot z\right)}^{2} - {\left(t \cdot i\right)}^{2}\right)}{c \cdot z + t \cdot i}\right) + j \cdot \left(c \cdot a - y \cdot i\right)\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if b < -3.3822588060010563e-116

    1. Initial program 9.8

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\]
    2. Simplified9.8

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, t \cdot i - c \cdot z, j \cdot \left(c \cdot a - y \cdot i\right)\right)\right)}\]
    3. Using strategy rm
    4. Applied fma-udef9.8

      \[\leadsto \color{blue}{x \cdot \left(y \cdot z - t \cdot a\right) + \mathsf{fma}\left(b, t \cdot i - c \cdot z, j \cdot \left(c \cdot a - y \cdot i\right)\right)}\]
    5. Using strategy rm
    6. Applied sub-neg9.8

      \[\leadsto x \cdot \left(y \cdot z - t \cdot a\right) + \mathsf{fma}\left(b, t \cdot i - c \cdot z, j \cdot \color{blue}{\left(c \cdot a + \left(-y \cdot i\right)\right)}\right)\]
    7. Applied distribute-lft-in9.8

      \[\leadsto x \cdot \left(y \cdot z - t \cdot a\right) + \mathsf{fma}\left(b, t \cdot i - c \cdot z, \color{blue}{j \cdot \left(c \cdot a\right) + j \cdot \left(-y \cdot i\right)}\right)\]
    8. Simplified10.1

      \[\leadsto x \cdot \left(y \cdot z - t \cdot a\right) + \mathsf{fma}\left(b, t \cdot i - c \cdot z, \color{blue}{a \cdot \left(j \cdot c\right)} + j \cdot \left(-y \cdot i\right)\right)\]
    9. Simplified10.1

      \[\leadsto x \cdot \left(y \cdot z - t \cdot a\right) + \mathsf{fma}\left(b, t \cdot i - c \cdot z, a \cdot \left(j \cdot c\right) + \color{blue}{\left(-y \cdot i\right) \cdot j}\right)\]
    10. Using strategy rm
    11. Applied sub-neg10.1

      \[\leadsto x \cdot \color{blue}{\left(y \cdot z + \left(-t \cdot a\right)\right)} + \mathsf{fma}\left(b, t \cdot i - c \cdot z, a \cdot \left(j \cdot c\right) + \left(-y \cdot i\right) \cdot j\right)\]
    12. Applied distribute-lft-in10.1

      \[\leadsto \color{blue}{\left(x \cdot \left(y \cdot z\right) + x \cdot \left(-t \cdot a\right)\right)} + \mathsf{fma}\left(b, t \cdot i - c \cdot z, a \cdot \left(j \cdot c\right) + \left(-y \cdot i\right) \cdot j\right)\]
    13. Simplified10.1

      \[\leadsto \left(\color{blue}{x \cdot \left(z \cdot y\right)} + x \cdot \left(-t \cdot a\right)\right) + \mathsf{fma}\left(b, t \cdot i - c \cdot z, a \cdot \left(j \cdot c\right) + \left(-y \cdot i\right) \cdot j\right)\]
    14. Simplified9.8

      \[\leadsto \left(x \cdot \left(z \cdot y\right) + \color{blue}{\left(-a \cdot \left(x \cdot t\right)\right)}\right) + \mathsf{fma}\left(b, t \cdot i - c \cdot z, a \cdot \left(j \cdot c\right) + \left(-y \cdot i\right) \cdot j\right)\]
    15. Using strategy rm
    16. Applied associate-*r*9.9

      \[\leadsto \left(\color{blue}{\left(x \cdot z\right) \cdot y} + \left(-a \cdot \left(x \cdot t\right)\right)\right) + \mathsf{fma}\left(b, t \cdot i - c \cdot z, a \cdot \left(j \cdot c\right) + \left(-y \cdot i\right) \cdot j\right)\]

    if -3.3822588060010563e-116 < b < 1.6274048386487055e-212

    1. Initial program 17.7

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\]
    2. Simplified17.7

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, t \cdot i - c \cdot z, j \cdot \left(c \cdot a - y \cdot i\right)\right)\right)}\]
    3. Using strategy rm
    4. Applied fma-udef17.7

      \[\leadsto \color{blue}{x \cdot \left(y \cdot z - t \cdot a\right) + \mathsf{fma}\left(b, t \cdot i - c \cdot z, j \cdot \left(c \cdot a - y \cdot i\right)\right)}\]
    5. Using strategy rm
    6. Applied sub-neg17.7

      \[\leadsto x \cdot \left(y \cdot z - t \cdot a\right) + \mathsf{fma}\left(b, t \cdot i - c \cdot z, j \cdot \color{blue}{\left(c \cdot a + \left(-y \cdot i\right)\right)}\right)\]
    7. Applied distribute-lft-in17.7

      \[\leadsto x \cdot \left(y \cdot z - t \cdot a\right) + \mathsf{fma}\left(b, t \cdot i - c \cdot z, \color{blue}{j \cdot \left(c \cdot a\right) + j \cdot \left(-y \cdot i\right)}\right)\]
    8. Simplified17.8

      \[\leadsto x \cdot \left(y \cdot z - t \cdot a\right) + \mathsf{fma}\left(b, t \cdot i - c \cdot z, \color{blue}{a \cdot \left(j \cdot c\right)} + j \cdot \left(-y \cdot i\right)\right)\]
    9. Simplified17.8

      \[\leadsto x \cdot \left(y \cdot z - t \cdot a\right) + \mathsf{fma}\left(b, t \cdot i - c \cdot z, a \cdot \left(j \cdot c\right) + \color{blue}{\left(-y \cdot i\right) \cdot j}\right)\]
    10. Taylor expanded around inf 15.8

      \[\leadsto x \cdot \left(y \cdot z - t \cdot a\right) + \color{blue}{\left(a \cdot \left(j \cdot c\right) - \left(z \cdot \left(b \cdot c\right) + i \cdot \left(y \cdot j\right)\right)\right)}\]
    11. Simplified14.9

      \[\leadsto x \cdot \left(y \cdot z - t \cdot a\right) + \color{blue}{\left(c \cdot \left(a \cdot j - z \cdot b\right) - \left(y \cdot i\right) \cdot j\right)}\]

    if 1.6274048386487055e-212 < b

    1. Initial program 11.2

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\]
    2. Simplified11.2

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, t \cdot i - c \cdot z, j \cdot \left(c \cdot a - y \cdot i\right)\right)\right)}\]
    3. Using strategy rm
    4. Applied fma-udef11.2

      \[\leadsto \color{blue}{x \cdot \left(y \cdot z - t \cdot a\right) + \mathsf{fma}\left(b, t \cdot i - c \cdot z, j \cdot \left(c \cdot a - y \cdot i\right)\right)}\]
    5. Using strategy rm
    6. Applied sub-neg11.2

      \[\leadsto x \cdot \left(y \cdot z - t \cdot a\right) + \mathsf{fma}\left(b, t \cdot i - c \cdot z, j \cdot \color{blue}{\left(c \cdot a + \left(-y \cdot i\right)\right)}\right)\]
    7. Applied distribute-lft-in11.2

      \[\leadsto x \cdot \left(y \cdot z - t \cdot a\right) + \mathsf{fma}\left(b, t \cdot i - c \cdot z, \color{blue}{j \cdot \left(c \cdot a\right) + j \cdot \left(-y \cdot i\right)}\right)\]
    8. Simplified11.3

      \[\leadsto x \cdot \left(y \cdot z - t \cdot a\right) + \mathsf{fma}\left(b, t \cdot i - c \cdot z, \color{blue}{a \cdot \left(j \cdot c\right)} + j \cdot \left(-y \cdot i\right)\right)\]
    9. Simplified11.3

      \[\leadsto x \cdot \left(y \cdot z - t \cdot a\right) + \mathsf{fma}\left(b, t \cdot i - c \cdot z, a \cdot \left(j \cdot c\right) + \color{blue}{\left(-y \cdot i\right) \cdot j}\right)\]
    10. Using strategy rm
    11. Applied sub-neg11.3

      \[\leadsto x \cdot \color{blue}{\left(y \cdot z + \left(-t \cdot a\right)\right)} + \mathsf{fma}\left(b, t \cdot i - c \cdot z, a \cdot \left(j \cdot c\right) + \left(-y \cdot i\right) \cdot j\right)\]
    12. Applied distribute-lft-in11.3

      \[\leadsto \color{blue}{\left(x \cdot \left(y \cdot z\right) + x \cdot \left(-t \cdot a\right)\right)} + \mathsf{fma}\left(b, t \cdot i - c \cdot z, a \cdot \left(j \cdot c\right) + \left(-y \cdot i\right) \cdot j\right)\]
    13. Simplified11.3

      \[\leadsto \left(\color{blue}{x \cdot \left(z \cdot y\right)} + x \cdot \left(-t \cdot a\right)\right) + \mathsf{fma}\left(b, t \cdot i - c \cdot z, a \cdot \left(j \cdot c\right) + \left(-y \cdot i\right) \cdot j\right)\]
    14. Simplified11.4

      \[\leadsto \left(x \cdot \left(z \cdot y\right) + \color{blue}{\left(-a \cdot \left(x \cdot t\right)\right)}\right) + \mathsf{fma}\left(b, t \cdot i - c \cdot z, a \cdot \left(j \cdot c\right) + \left(-y \cdot i\right) \cdot j\right)\]
    15. Using strategy rm
    16. Applied distribute-rgt-neg-in11.4

      \[\leadsto \left(x \cdot \left(z \cdot y\right) + \left(-a \cdot \left(x \cdot t\right)\right)\right) + \mathsf{fma}\left(b, t \cdot i - c \cdot z, a \cdot \left(j \cdot c\right) + \color{blue}{\left(y \cdot \left(-i\right)\right)} \cdot j\right)\]
    17. Applied associate-*l*10.8

      \[\leadsto \left(x \cdot \left(z \cdot y\right) + \left(-a \cdot \left(x \cdot t\right)\right)\right) + \mathsf{fma}\left(b, t \cdot i - c \cdot z, a \cdot \left(j \cdot c\right) + \color{blue}{y \cdot \left(\left(-i\right) \cdot j\right)}\right)\]
    18. Simplified10.8

      \[\leadsto \left(x \cdot \left(z \cdot y\right) + \left(-a \cdot \left(x \cdot t\right)\right)\right) + \mathsf{fma}\left(b, t \cdot i - c \cdot z, a \cdot \left(j \cdot c\right) + y \cdot \color{blue}{\left(-i \cdot j\right)}\right)\]
  3. Recombined 3 regimes into one program.
  4. Final simplification11.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -3.382258806001056297221939326237757014037 \cdot 10^{-116}:\\ \;\;\;\;\left(\left(x \cdot z\right) \cdot y + \left(-a \cdot \left(x \cdot t\right)\right)\right) + \mathsf{fma}\left(b, t \cdot i - c \cdot z, a \cdot \left(j \cdot c\right) + \left(-y \cdot i\right) \cdot j\right)\\ \mathbf{elif}\;b \le 1.627404838648705499216592053613665466888 \cdot 10^{-212}:\\ \;\;\;\;x \cdot \left(y \cdot z - t \cdot a\right) + \left(c \cdot \left(a \cdot j - z \cdot b\right) - \left(y \cdot i\right) \cdot j\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot \left(z \cdot y\right) + \left(-a \cdot \left(x \cdot t\right)\right)\right) + \mathsf{fma}\left(b, t \cdot i - c \cdot z, a \cdot \left(j \cdot c\right) + y \cdot \left(-i \cdot j\right)\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019350 +o rules:numerics
(FPCore (x y z t a b c i j)
  :name "Data.Colour.Matrix:determinant from colour-2.3.3, A"
  :precision binary64

  :herbie-target
  (if (< x -1.469694296777705e-64) (+ (- (* x (- (* y z) (* t a))) (/ (* b (- (pow (* c z) 2) (pow (* t i) 2))) (+ (* c z) (* t i)))) (* j (- (* c a) (* y i)))) (if (< x 3.2113527362226803e-147) (- (* (- (* b i) (* x a)) t) (- (* z (* c b)) (* j (- (* c a) (* y i))))) (+ (- (* x (- (* y z) (* t a))) (/ (* b (- (pow (* c z) 2) (pow (* t i) 2))) (+ (* c z) (* t i)))) (* j (- (* c a) (* y i))))))

  (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* t i)))) (* j (- (* c a) (* y i)))))