Average Error: 11.9 → 13.1
Time: 16.3s
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}\;j \le -6.4495839482546187 \cdot 10^{-305} \lor \neg \left(j \le 4.19755113566794436 \cdot 10^{-217}\right):\\ \;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, j, \left(x \cdot \mathsf{fma}\left(y, z, -a \cdot t\right) + x \cdot \mathsf{fma}\left(-a, t, a \cdot t\right)\right) - \left(\left(\sqrt[3]{b} \cdot \sqrt[3]{b}\right) \cdot \left(\sqrt[3]{b} \cdot \left(c \cdot z\right)\right) + b \cdot \left(-t \cdot i\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t, i \cdot b, -\mathsf{fma}\left(z, b \cdot c, t \cdot \left(x \cdot a\right)\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}\;j \le -6.4495839482546187 \cdot 10^{-305} \lor \neg \left(j \le 4.19755113566794436 \cdot 10^{-217}\right):\\
\;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, j, \left(x \cdot \mathsf{fma}\left(y, z, -a \cdot t\right) + x \cdot \mathsf{fma}\left(-a, t, a \cdot t\right)\right) - \left(\left(\sqrt[3]{b} \cdot \sqrt[3]{b}\right) \cdot \left(\sqrt[3]{b} \cdot \left(c \cdot z\right)\right) + b \cdot \left(-t \cdot i\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t, i \cdot b, -\mathsf{fma}\left(z, b \cdot c, t \cdot \left(x \cdot a\right)\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 r859840 = x;
        double r859841 = y;
        double r859842 = z;
        double r859843 = r859841 * r859842;
        double r859844 = t;
        double r859845 = a;
        double r859846 = r859844 * r859845;
        double r859847 = r859843 - r859846;
        double r859848 = r859840 * r859847;
        double r859849 = b;
        double r859850 = c;
        double r859851 = r859850 * r859842;
        double r859852 = i;
        double r859853 = r859844 * r859852;
        double r859854 = r859851 - r859853;
        double r859855 = r859849 * r859854;
        double r859856 = r859848 - r859855;
        double r859857 = j;
        double r859858 = r859850 * r859845;
        double r859859 = r859841 * r859852;
        double r859860 = r859858 - r859859;
        double r859861 = r859857 * r859860;
        double r859862 = r859856 + r859861;
        return r859862;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r859863 = j;
        double r859864 = -6.449583948254619e-305;
        bool r859865 = r859863 <= r859864;
        double r859866 = 4.197551135667944e-217;
        bool r859867 = r859863 <= r859866;
        double r859868 = !r859867;
        bool r859869 = r859865 || r859868;
        double r859870 = c;
        double r859871 = a;
        double r859872 = r859870 * r859871;
        double r859873 = y;
        double r859874 = i;
        double r859875 = r859873 * r859874;
        double r859876 = r859872 - r859875;
        double r859877 = x;
        double r859878 = z;
        double r859879 = t;
        double r859880 = r859871 * r859879;
        double r859881 = -r859880;
        double r859882 = fma(r859873, r859878, r859881);
        double r859883 = r859877 * r859882;
        double r859884 = -r859871;
        double r859885 = fma(r859884, r859879, r859880);
        double r859886 = r859877 * r859885;
        double r859887 = r859883 + r859886;
        double r859888 = b;
        double r859889 = cbrt(r859888);
        double r859890 = r859889 * r859889;
        double r859891 = r859870 * r859878;
        double r859892 = r859889 * r859891;
        double r859893 = r859890 * r859892;
        double r859894 = r859879 * r859874;
        double r859895 = -r859894;
        double r859896 = r859888 * r859895;
        double r859897 = r859893 + r859896;
        double r859898 = r859887 - r859897;
        double r859899 = fma(r859876, r859863, r859898);
        double r859900 = r859874 * r859888;
        double r859901 = r859888 * r859870;
        double r859902 = r859877 * r859871;
        double r859903 = r859879 * r859902;
        double r859904 = fma(r859878, r859901, r859903);
        double r859905 = -r859904;
        double r859906 = fma(r859879, r859900, r859905);
        double r859907 = r859869 ? r859899 : r859906;
        return r859907;
}

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.9
Target19.9
Herbie13.1
\[\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 2 regimes
  2. if j < -6.449583948254619e-305 or 4.197551135667944e-217 < j

    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(c \cdot a - y \cdot i, j, x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right)}\]
    3. Using strategy rm
    4. Applied prod-diff11.2

      \[\leadsto \mathsf{fma}\left(c \cdot a - y \cdot i, j, 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)\]
    5. Applied distribute-lft-in11.2

      \[\leadsto \mathsf{fma}\left(c \cdot a - y \cdot i, j, \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)\]
    6. Using strategy rm
    7. Applied sub-neg11.2

      \[\leadsto \mathsf{fma}\left(c \cdot a - y \cdot i, j, \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 \color{blue}{\left(c \cdot z + \left(-t \cdot i\right)\right)}\right)\]
    8. Applied distribute-lft-in11.2

      \[\leadsto \mathsf{fma}\left(c \cdot a - y \cdot i, j, \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(b \cdot \left(c \cdot z\right) + b \cdot \left(-t \cdot i\right)\right)}\right)\]
    9. Using strategy rm
    10. Applied add-cube-cbrt11.4

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

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

    if -6.449583948254619e-305 < j < 4.197551135667944e-217

    1. Initial program 17.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. Simplified17.8

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

      \[\leadsto \color{blue}{t \cdot \left(i \cdot b\right) - \left(z \cdot \left(b \cdot c\right) + t \cdot \left(x \cdot a\right)\right)}\]
    4. Simplified28.7

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;j \le -6.4495839482546187 \cdot 10^{-305} \lor \neg \left(j \le 4.19755113566794436 \cdot 10^{-217}\right):\\ \;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, j, \left(x \cdot \mathsf{fma}\left(y, z, -a \cdot t\right) + x \cdot \mathsf{fma}\left(-a, t, a \cdot t\right)\right) - \left(\left(\sqrt[3]{b} \cdot \sqrt[3]{b}\right) \cdot \left(\sqrt[3]{b} \cdot \left(c \cdot z\right)\right) + b \cdot \left(-t \cdot i\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t, i \cdot b, -\mathsf{fma}\left(z, b \cdot c, t \cdot \left(x \cdot a\right)\right)\right)\\ \end{array}\]

Reproduce

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