Average Error: 12.6 → 11.7
Time: 9.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 -5.87029124636687325 \cdot 10^{-46}:\\ \;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - \left(z \cdot \left(b \cdot c\right) + \left(-b\right) \cdot \left(t \cdot i\right)\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\\ \mathbf{elif}\;x \le 2.83754174328183624 \cdot 10^{-162}:\\ \;\;\;\;\mathsf{fma}\left(t, i \cdot b, -\mathsf{fma}\left(z, b \cdot c, a \cdot \left(x \cdot t\right)\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - \left(\sqrt[3]{b \cdot \left(c \cdot z - t \cdot i\right)} \cdot \sqrt[3]{b \cdot \left(c \cdot z - t \cdot i\right)}\right) \cdot \sqrt[3]{b \cdot \left(c \cdot z - t \cdot i\right)}\right) + \left(j \cdot \left(c \cdot a - y \cdot i\right) + j \cdot \mathsf{fma}\left(-i, y, i \cdot y\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}\;x \le -5.87029124636687325 \cdot 10^{-46}:\\
\;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - \left(z \cdot \left(b \cdot c\right) + \left(-b\right) \cdot \left(t \cdot i\right)\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\\

\mathbf{elif}\;x \le 2.83754174328183624 \cdot 10^{-162}:\\
\;\;\;\;\mathsf{fma}\left(t, i \cdot b, -\mathsf{fma}\left(z, b \cdot c, a \cdot \left(x \cdot t\right)\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\\

\mathbf{else}:\\
\;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - \left(\sqrt[3]{b \cdot \left(c \cdot z - t \cdot i\right)} \cdot \sqrt[3]{b \cdot \left(c \cdot z - t \cdot i\right)}\right) \cdot \sqrt[3]{b \cdot \left(c \cdot z - t \cdot i\right)}\right) + \left(j \cdot \left(c \cdot a - y \cdot i\right) + j \cdot \mathsf{fma}\left(-i, y, i \cdot y\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 r1001810 = x;
        double r1001811 = y;
        double r1001812 = z;
        double r1001813 = r1001811 * r1001812;
        double r1001814 = t;
        double r1001815 = a;
        double r1001816 = r1001814 * r1001815;
        double r1001817 = r1001813 - r1001816;
        double r1001818 = r1001810 * r1001817;
        double r1001819 = b;
        double r1001820 = c;
        double r1001821 = r1001820 * r1001812;
        double r1001822 = i;
        double r1001823 = r1001814 * r1001822;
        double r1001824 = r1001821 - r1001823;
        double r1001825 = r1001819 * r1001824;
        double r1001826 = r1001818 - r1001825;
        double r1001827 = j;
        double r1001828 = r1001820 * r1001815;
        double r1001829 = r1001811 * r1001822;
        double r1001830 = r1001828 - r1001829;
        double r1001831 = r1001827 * r1001830;
        double r1001832 = r1001826 + r1001831;
        return r1001832;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r1001833 = x;
        double r1001834 = -5.870291246366873e-46;
        bool r1001835 = r1001833 <= r1001834;
        double r1001836 = y;
        double r1001837 = z;
        double r1001838 = r1001836 * r1001837;
        double r1001839 = t;
        double r1001840 = a;
        double r1001841 = r1001839 * r1001840;
        double r1001842 = r1001838 - r1001841;
        double r1001843 = r1001833 * r1001842;
        double r1001844 = b;
        double r1001845 = c;
        double r1001846 = r1001844 * r1001845;
        double r1001847 = r1001837 * r1001846;
        double r1001848 = -r1001844;
        double r1001849 = i;
        double r1001850 = r1001839 * r1001849;
        double r1001851 = r1001848 * r1001850;
        double r1001852 = r1001847 + r1001851;
        double r1001853 = r1001843 - r1001852;
        double r1001854 = j;
        double r1001855 = r1001845 * r1001840;
        double r1001856 = r1001836 * r1001849;
        double r1001857 = r1001855 - r1001856;
        double r1001858 = r1001854 * r1001857;
        double r1001859 = r1001853 + r1001858;
        double r1001860 = 2.837541743281836e-162;
        bool r1001861 = r1001833 <= r1001860;
        double r1001862 = r1001849 * r1001844;
        double r1001863 = r1001833 * r1001839;
        double r1001864 = r1001840 * r1001863;
        double r1001865 = fma(r1001837, r1001846, r1001864);
        double r1001866 = -r1001865;
        double r1001867 = fma(r1001839, r1001862, r1001866);
        double r1001868 = r1001867 + r1001858;
        double r1001869 = r1001845 * r1001837;
        double r1001870 = r1001869 - r1001850;
        double r1001871 = r1001844 * r1001870;
        double r1001872 = cbrt(r1001871);
        double r1001873 = r1001872 * r1001872;
        double r1001874 = r1001873 * r1001872;
        double r1001875 = r1001843 - r1001874;
        double r1001876 = -r1001849;
        double r1001877 = r1001849 * r1001836;
        double r1001878 = fma(r1001876, r1001836, r1001877);
        double r1001879 = r1001854 * r1001878;
        double r1001880 = r1001858 + r1001879;
        double r1001881 = r1001875 + r1001880;
        double r1001882 = r1001861 ? r1001868 : r1001881;
        double r1001883 = r1001835 ? r1001859 : r1001882;
        return r1001883;
}

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.6
Target20.2
Herbie11.7
\[\begin{array}{l} \mathbf{if}\;x \lt -1.46969429677770502 \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.2113527362226803 \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 < -5.870291246366873e-46

    1. Initial program 8.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. Using strategy rm
    3. Applied add-cube-cbrt8.4

      \[\leadsto \left(x \cdot \left(y \cdot z - t \cdot a\right) - \color{blue}{\left(\left(\sqrt[3]{b} \cdot \sqrt[3]{b}\right) \cdot \sqrt[3]{b}\right)} \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\]
    4. Applied associate-*l*8.4

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

      \[\leadsto \left(x \cdot \left(y \cdot z - t \cdot a\right) - \left(\sqrt[3]{b} \cdot \sqrt[3]{b}\right) \cdot \left(\sqrt[3]{b} \cdot \color{blue}{\left(c \cdot z + \left(-t \cdot i\right)\right)}\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\]
    7. Applied distribute-lft-in8.4

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

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

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

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

    if -5.870291246366873e-46 < x < 2.837541743281836e-162

    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. Taylor expanded around inf 14.2

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

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

    if 2.837541743281836e-162 < x

    1. Initial program 10.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. Using strategy rm
    3. Applied prod-diff10.3

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -5.87029124636687325 \cdot 10^{-46}:\\ \;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - \left(z \cdot \left(b \cdot c\right) + \left(-b\right) \cdot \left(t \cdot i\right)\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\\ \mathbf{elif}\;x \le 2.83754174328183624 \cdot 10^{-162}:\\ \;\;\;\;\mathsf{fma}\left(t, i \cdot b, -\mathsf{fma}\left(z, b \cdot c, a \cdot \left(x \cdot t\right)\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - \left(\sqrt[3]{b \cdot \left(c \cdot z - t \cdot i\right)} \cdot \sqrt[3]{b \cdot \left(c \cdot z - t \cdot i\right)}\right) \cdot \sqrt[3]{b \cdot \left(c \cdot z - t \cdot i\right)}\right) + \left(j \cdot \left(c \cdot a - y \cdot i\right) + j \cdot \mathsf{fma}\left(-i, y, i \cdot y\right)\right)\\ \end{array}\]

Reproduce

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