Average Error: 12.1 → 11.5
Time: 29.1s
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 -8.697492811378026850633612726154587574168 \cdot 10^{-50}:\\ \;\;\;\;\left(\left(x \cdot \left(y \cdot z - t \cdot a\right) - \left(\sqrt[3]{\mathsf{fma}\left(c, z, -i \cdot t\right) \cdot b} \cdot \sqrt[3]{\mathsf{fma}\left(c, z, -i \cdot t\right) \cdot b}\right) \cdot \sqrt[3]{\mathsf{fma}\left(c, z, -i \cdot t\right) \cdot b}\right) - b \cdot \mathsf{fma}\left(-i, t, i \cdot t\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\\ \mathbf{elif}\;x \le 2.225911783279939279664833080419663595995 \cdot 10^{-206}:\\ \;\;\;\;\left(b \cdot \left(i \cdot t - c \cdot z\right) - a \cdot \left(x \cdot t\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\sqrt{x} \cdot \left(\sqrt{x} \cdot \left(y \cdot z - t \cdot a\right)\right) - \mathsf{fma}\left(c, z, -i \cdot t\right) \cdot b\right) - b \cdot \mathsf{fma}\left(-i, t, i \cdot t\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}\;x \le -8.697492811378026850633612726154587574168 \cdot 10^{-50}:\\
\;\;\;\;\left(\left(x \cdot \left(y \cdot z - t \cdot a\right) - \left(\sqrt[3]{\mathsf{fma}\left(c, z, -i \cdot t\right) \cdot b} \cdot \sqrt[3]{\mathsf{fma}\left(c, z, -i \cdot t\right) \cdot b}\right) \cdot \sqrt[3]{\mathsf{fma}\left(c, z, -i \cdot t\right) \cdot b}\right) - b \cdot \mathsf{fma}\left(-i, t, i \cdot t\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\\

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

\mathbf{else}:\\
\;\;\;\;\left(\left(\sqrt{x} \cdot \left(\sqrt{x} \cdot \left(y \cdot z - t \cdot a\right)\right) - \mathsf{fma}\left(c, z, -i \cdot t\right) \cdot b\right) - b \cdot \mathsf{fma}\left(-i, t, i \cdot t\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 r563957 = x;
        double r563958 = y;
        double r563959 = z;
        double r563960 = r563958 * r563959;
        double r563961 = t;
        double r563962 = a;
        double r563963 = r563961 * r563962;
        double r563964 = r563960 - r563963;
        double r563965 = r563957 * r563964;
        double r563966 = b;
        double r563967 = c;
        double r563968 = r563967 * r563959;
        double r563969 = i;
        double r563970 = r563961 * r563969;
        double r563971 = r563968 - r563970;
        double r563972 = r563966 * r563971;
        double r563973 = r563965 - r563972;
        double r563974 = j;
        double r563975 = r563967 * r563962;
        double r563976 = r563958 * r563969;
        double r563977 = r563975 - r563976;
        double r563978 = r563974 * r563977;
        double r563979 = r563973 + r563978;
        return r563979;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r563980 = x;
        double r563981 = -8.697492811378027e-50;
        bool r563982 = r563980 <= r563981;
        double r563983 = y;
        double r563984 = z;
        double r563985 = r563983 * r563984;
        double r563986 = t;
        double r563987 = a;
        double r563988 = r563986 * r563987;
        double r563989 = r563985 - r563988;
        double r563990 = r563980 * r563989;
        double r563991 = c;
        double r563992 = i;
        double r563993 = r563992 * r563986;
        double r563994 = -r563993;
        double r563995 = fma(r563991, r563984, r563994);
        double r563996 = b;
        double r563997 = r563995 * r563996;
        double r563998 = cbrt(r563997);
        double r563999 = r563998 * r563998;
        double r564000 = r563999 * r563998;
        double r564001 = r563990 - r564000;
        double r564002 = -r563992;
        double r564003 = fma(r564002, r563986, r563993);
        double r564004 = r563996 * r564003;
        double r564005 = r564001 - r564004;
        double r564006 = j;
        double r564007 = r563991 * r563987;
        double r564008 = r563983 * r563992;
        double r564009 = r564007 - r564008;
        double r564010 = r564006 * r564009;
        double r564011 = r564005 + r564010;
        double r564012 = 2.2259117832799393e-206;
        bool r564013 = r563980 <= r564012;
        double r564014 = r563991 * r563984;
        double r564015 = r563993 - r564014;
        double r564016 = r563996 * r564015;
        double r564017 = r563980 * r563986;
        double r564018 = r563987 * r564017;
        double r564019 = r564016 - r564018;
        double r564020 = r564019 + r564010;
        double r564021 = sqrt(r563980);
        double r564022 = r564021 * r563989;
        double r564023 = r564021 * r564022;
        double r564024 = r564023 - r563997;
        double r564025 = r564024 - r564004;
        double r564026 = r564025 + r564010;
        double r564027 = r564013 ? r564020 : r564026;
        double r564028 = r563982 ? r564011 : r564027;
        return r564028;
}

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.1
Target19.8
Herbie11.5
\[\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 < -8.697492811378027e-50

    1. Initial program 8.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-diff8.3

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

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

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

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

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

    if -8.697492811378027e-50 < x < 2.2259117832799393e-206

    1. Initial program 16.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. Taylor expanded around inf 13.8

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

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

    if 2.2259117832799393e-206 < x

    1. Initial program 10.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-diff10.5

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

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

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

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

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

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

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

Reproduce

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