Average Error: 12.2 → 13.3
Time: 25.6s
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}\;x \le -4.678704205438575893120558096144862893829 \cdot 10^{89}:\\ \;\;\;\;\mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, t \cdot i - c \cdot z, \left(\sqrt[3]{j} \cdot \sqrt[3]{j}\right) \cdot \left(\sqrt[3]{j} \cdot \left(c \cdot a - y \cdot i\right)\right)\right)\right)\\ \mathbf{elif}\;x \le -4.270541356322630425633982315397992209855 \cdot 10^{-250} \lor \neg \left(x \le 3.363483265951427129429676499791780808133 \cdot 10^{-255}\right):\\ \;\;\;\;\mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, t \cdot i - c \cdot z, a \cdot \left(j \cdot c\right) + \left(-i \cdot \left(y \cdot j\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;c \cdot \left(a \cdot j - z \cdot b\right) - i \cdot \left(y \cdot j\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}\;x \le -4.678704205438575893120558096144862893829 \cdot 10^{89}:\\
\;\;\;\;\mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, t \cdot i - c \cdot z, \left(\sqrt[3]{j} \cdot \sqrt[3]{j}\right) \cdot \left(\sqrt[3]{j} \cdot \left(c \cdot a - y \cdot i\right)\right)\right)\right)\\

\mathbf{elif}\;x \le -4.270541356322630425633982315397992209855 \cdot 10^{-250} \lor \neg \left(x \le 3.363483265951427129429676499791780808133 \cdot 10^{-255}\right):\\
\;\;\;\;\mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, t \cdot i - c \cdot z, a \cdot \left(j \cdot c\right) + \left(-i \cdot \left(y \cdot j\right)\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;c \cdot \left(a \cdot j - z \cdot b\right) - i \cdot \left(y \cdot j\right)\\

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r555742 = x;
        double r555743 = y;
        double r555744 = z;
        double r555745 = r555743 * r555744;
        double r555746 = t;
        double r555747 = a;
        double r555748 = r555746 * r555747;
        double r555749 = r555745 - r555748;
        double r555750 = r555742 * r555749;
        double r555751 = b;
        double r555752 = c;
        double r555753 = r555752 * r555744;
        double r555754 = i;
        double r555755 = r555746 * r555754;
        double r555756 = r555753 - r555755;
        double r555757 = r555751 * r555756;
        double r555758 = r555750 - r555757;
        double r555759 = j;
        double r555760 = r555752 * r555747;
        double r555761 = r555743 * r555754;
        double r555762 = r555760 - r555761;
        double r555763 = r555759 * r555762;
        double r555764 = r555758 + r555763;
        return r555764;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r555765 = x;
        double r555766 = -4.678704205438576e+89;
        bool r555767 = r555765 <= r555766;
        double r555768 = y;
        double r555769 = z;
        double r555770 = r555768 * r555769;
        double r555771 = t;
        double r555772 = a;
        double r555773 = r555771 * r555772;
        double r555774 = r555770 - r555773;
        double r555775 = b;
        double r555776 = i;
        double r555777 = r555771 * r555776;
        double r555778 = c;
        double r555779 = r555778 * r555769;
        double r555780 = r555777 - r555779;
        double r555781 = j;
        double r555782 = cbrt(r555781);
        double r555783 = r555782 * r555782;
        double r555784 = r555778 * r555772;
        double r555785 = r555768 * r555776;
        double r555786 = r555784 - r555785;
        double r555787 = r555782 * r555786;
        double r555788 = r555783 * r555787;
        double r555789 = fma(r555775, r555780, r555788);
        double r555790 = fma(r555765, r555774, r555789);
        double r555791 = -4.2705413563226304e-250;
        bool r555792 = r555765 <= r555791;
        double r555793 = 3.363483265951427e-255;
        bool r555794 = r555765 <= r555793;
        double r555795 = !r555794;
        bool r555796 = r555792 || r555795;
        double r555797 = r555781 * r555778;
        double r555798 = r555772 * r555797;
        double r555799 = r555768 * r555781;
        double r555800 = r555776 * r555799;
        double r555801 = -r555800;
        double r555802 = r555798 + r555801;
        double r555803 = fma(r555775, r555780, r555802);
        double r555804 = fma(r555765, r555774, r555803);
        double r555805 = r555772 * r555781;
        double r555806 = r555769 * r555775;
        double r555807 = r555805 - r555806;
        double r555808 = r555778 * r555807;
        double r555809 = r555808 - r555800;
        double r555810 = r555796 ? r555804 : r555809;
        double r555811 = r555767 ? r555790 : r555810;
        return r555811;
}

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.2
Target19.1
Herbie13.3
\[\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 x < -4.678704205438576e+89

    1. Initial program 7.0

      \[\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. Simplified7.0

      \[\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 add-cube-cbrt7.2

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

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

    if -4.678704205438576e+89 < x < -4.2705413563226304e-250 or 3.363483265951427e-255 < x

    1. Initial program 12.3

      \[\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. Simplified12.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 add-cube-cbrt12.5

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

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

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

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

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

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

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

    if -4.2705413563226304e-250 < x < 3.363483265951427e-255

    1. Initial program 17.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. Simplified17.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 add-cube-cbrt17.6

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

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

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

      \[\leadsto \color{blue}{c \cdot \left(a \cdot j - z \cdot b\right) - i \cdot \left(y \cdot j\right)}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification13.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -4.678704205438575893120558096144862893829 \cdot 10^{89}:\\ \;\;\;\;\mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, t \cdot i - c \cdot z, \left(\sqrt[3]{j} \cdot \sqrt[3]{j}\right) \cdot \left(\sqrt[3]{j} \cdot \left(c \cdot a - y \cdot i\right)\right)\right)\right)\\ \mathbf{elif}\;x \le -4.270541356322630425633982315397992209855 \cdot 10^{-250} \lor \neg \left(x \le 3.363483265951427129429676499791780808133 \cdot 10^{-255}\right):\\ \;\;\;\;\mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, t \cdot i - c \cdot z, a \cdot \left(j \cdot c\right) + \left(-i \cdot \left(y \cdot j\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;c \cdot \left(a \cdot j - z \cdot b\right) - i \cdot \left(y \cdot j\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019326 +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)))))