Average Error: 11.8 → 12.0
Time: 10.7s
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.61241332718547359 \cdot 10^{-185}:\\ \;\;\;\;\left(\left(\left(\sqrt[3]{x \cdot \mathsf{fma}\left(y, z, -a \cdot t\right)} \cdot \sqrt[3]{x \cdot \mathsf{fma}\left(y, z, -a \cdot t\right)}\right) \cdot \sqrt[3]{x \cdot \mathsf{fma}\left(y, z, -a \cdot t\right)} + x \cdot \mathsf{fma}\left(-a, t, a \cdot t\right)\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\\ \mathbf{elif}\;b \le 1.3219369501169688 \cdot 10^{-259}:\\ \;\;\;\;\left(\left(\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot \mathsf{fma}\left(y, z, -a \cdot t\right)\right) + x \cdot \mathsf{fma}\left(-a, t, a \cdot t\right)\right) - 0\right) + j \cdot \left(c \cdot a - y \cdot i\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(x \cdot \mathsf{fma}\left(y, z, -a \cdot t\right) + x \cdot \mathsf{fma}\left(-a, t, a \cdot t\right)\right) - \sqrt{b} \cdot \left(\sqrt{b} \cdot \left(c \cdot z - t \cdot i\right)\right)\right) + j \cdot \left(c \cdot a - y \cdot i\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.61241332718547359 \cdot 10^{-185}:\\
\;\;\;\;\left(\left(\left(\sqrt[3]{x \cdot \mathsf{fma}\left(y, z, -a \cdot t\right)} \cdot \sqrt[3]{x \cdot \mathsf{fma}\left(y, z, -a \cdot t\right)}\right) \cdot \sqrt[3]{x \cdot \mathsf{fma}\left(y, z, -a \cdot t\right)} + x \cdot \mathsf{fma}\left(-a, t, a \cdot t\right)\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\\

\mathbf{elif}\;b \le 1.3219369501169688 \cdot 10^{-259}:\\
\;\;\;\;\left(\left(\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot \mathsf{fma}\left(y, z, -a \cdot t\right)\right) + x \cdot \mathsf{fma}\left(-a, t, a \cdot t\right)\right) - 0\right) + j \cdot \left(c \cdot a - y \cdot i\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r833806 = x;
        double r833807 = y;
        double r833808 = z;
        double r833809 = r833807 * r833808;
        double r833810 = t;
        double r833811 = a;
        double r833812 = r833810 * r833811;
        double r833813 = r833809 - r833812;
        double r833814 = r833806 * r833813;
        double r833815 = b;
        double r833816 = c;
        double r833817 = r833816 * r833808;
        double r833818 = i;
        double r833819 = r833810 * r833818;
        double r833820 = r833817 - r833819;
        double r833821 = r833815 * r833820;
        double r833822 = r833814 - r833821;
        double r833823 = j;
        double r833824 = r833816 * r833811;
        double r833825 = r833807 * r833818;
        double r833826 = r833824 - r833825;
        double r833827 = r833823 * r833826;
        double r833828 = r833822 + r833827;
        return r833828;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r833829 = b;
        double r833830 = -3.6124133271854736e-185;
        bool r833831 = r833829 <= r833830;
        double r833832 = x;
        double r833833 = y;
        double r833834 = z;
        double r833835 = a;
        double r833836 = t;
        double r833837 = r833835 * r833836;
        double r833838 = -r833837;
        double r833839 = fma(r833833, r833834, r833838);
        double r833840 = r833832 * r833839;
        double r833841 = cbrt(r833840);
        double r833842 = r833841 * r833841;
        double r833843 = r833842 * r833841;
        double r833844 = -r833835;
        double r833845 = fma(r833844, r833836, r833837);
        double r833846 = r833832 * r833845;
        double r833847 = r833843 + r833846;
        double r833848 = c;
        double r833849 = r833848 * r833834;
        double r833850 = i;
        double r833851 = r833836 * r833850;
        double r833852 = r833849 - r833851;
        double r833853 = r833829 * r833852;
        double r833854 = r833847 - r833853;
        double r833855 = j;
        double r833856 = r833848 * r833835;
        double r833857 = r833833 * r833850;
        double r833858 = r833856 - r833857;
        double r833859 = r833855 * r833858;
        double r833860 = r833854 + r833859;
        double r833861 = 1.3219369501169688e-259;
        bool r833862 = r833829 <= r833861;
        double r833863 = cbrt(r833832);
        double r833864 = r833863 * r833863;
        double r833865 = r833863 * r833839;
        double r833866 = r833864 * r833865;
        double r833867 = r833866 + r833846;
        double r833868 = 0.0;
        double r833869 = r833867 - r833868;
        double r833870 = r833869 + r833859;
        double r833871 = r833840 + r833846;
        double r833872 = sqrt(r833829);
        double r833873 = r833872 * r833852;
        double r833874 = r833872 * r833873;
        double r833875 = r833871 - r833874;
        double r833876 = r833875 + r833859;
        double r833877 = r833862 ? r833870 : r833876;
        double r833878 = r833831 ? r833860 : r833877;
        return r833878;
}

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

Original11.8
Target19.9
Herbie12.0
\[\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 b < -3.6124133271854736e-185

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

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

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

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

    if -3.6124133271854736e-185 < b < 1.3219369501169688e-259

    1. Initial program 16.4

      \[\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-diff16.4

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

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

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

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

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

    if 1.3219369501169688e-259 < b

    1. Initial program 11.5

      \[\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-diff11.5

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

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

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

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

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

Reproduce

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