Average Error: 12.2 → 12.0
Time: 30.2s
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}\;a \le -4.78207461594847479170920065988138565588 \cdot 10^{103}:\\ \;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, j, \left(z \cdot x\right) \cdot y - \mathsf{fma}\left(a, t \cdot x, z \cdot \left(c \cdot b\right)\right)\right)\\ \mathbf{elif}\;a \le 2.49629468667028412337712615225531683659 \cdot 10^{-101}:\\ \;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, j, \mathsf{fma}\left(b, \mathsf{fma}\left(i, t, c \cdot \left(-z\right)\right), \sqrt[3]{x} \cdot \left(\left(\sqrt[3]{\mathsf{fma}\left(y, z, t \cdot \left(-a\right)\right) \cdot \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right)} \cdot \sqrt[3]{\mathsf{fma}\left(y, z, t \cdot \left(-a\right)\right) \cdot \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right)}\right) \cdot \sqrt[3]{\mathsf{fma}\left(y, z, t \cdot \left(-a\right)\right) \cdot \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right)}\right)\right)\right)\\ \mathbf{elif}\;a \le 5.224383058243162557955086333333081930215 \cdot 10^{120}:\\ \;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, j, \mathsf{fma}\left(b, \mathsf{fma}\left(i, t, c \cdot \left(-z\right)\right), \mathsf{fma}\left(y \cdot x, z, -\left(a \cdot t\right) \cdot x\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, j, \left(z \cdot x\right) \cdot y - \mathsf{fma}\left(a, t \cdot x, z \cdot \left(c \cdot b\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}\;a \le -4.78207461594847479170920065988138565588 \cdot 10^{103}:\\
\;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, j, \left(z \cdot x\right) \cdot y - \mathsf{fma}\left(a, t \cdot x, z \cdot \left(c \cdot b\right)\right)\right)\\

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

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, j, \left(z \cdot x\right) \cdot y - \mathsf{fma}\left(a, t \cdot x, z \cdot \left(c \cdot b\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 r531001 = x;
        double r531002 = y;
        double r531003 = z;
        double r531004 = r531002 * r531003;
        double r531005 = t;
        double r531006 = a;
        double r531007 = r531005 * r531006;
        double r531008 = r531004 - r531007;
        double r531009 = r531001 * r531008;
        double r531010 = b;
        double r531011 = c;
        double r531012 = r531011 * r531003;
        double r531013 = i;
        double r531014 = r531005 * r531013;
        double r531015 = r531012 - r531014;
        double r531016 = r531010 * r531015;
        double r531017 = r531009 - r531016;
        double r531018 = j;
        double r531019 = r531011 * r531006;
        double r531020 = r531002 * r531013;
        double r531021 = r531019 - r531020;
        double r531022 = r531018 * r531021;
        double r531023 = r531017 + r531022;
        return r531023;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r531024 = a;
        double r531025 = -4.782074615948475e+103;
        bool r531026 = r531024 <= r531025;
        double r531027 = c;
        double r531028 = r531027 * r531024;
        double r531029 = y;
        double r531030 = i;
        double r531031 = r531029 * r531030;
        double r531032 = r531028 - r531031;
        double r531033 = j;
        double r531034 = z;
        double r531035 = x;
        double r531036 = r531034 * r531035;
        double r531037 = r531036 * r531029;
        double r531038 = t;
        double r531039 = r531038 * r531035;
        double r531040 = b;
        double r531041 = r531027 * r531040;
        double r531042 = r531034 * r531041;
        double r531043 = fma(r531024, r531039, r531042);
        double r531044 = r531037 - r531043;
        double r531045 = fma(r531032, r531033, r531044);
        double r531046 = 2.496294686670284e-101;
        bool r531047 = r531024 <= r531046;
        double r531048 = -r531034;
        double r531049 = r531027 * r531048;
        double r531050 = fma(r531030, r531038, r531049);
        double r531051 = cbrt(r531035);
        double r531052 = -r531024;
        double r531053 = r531038 * r531052;
        double r531054 = fma(r531029, r531034, r531053);
        double r531055 = r531051 * r531051;
        double r531056 = r531054 * r531055;
        double r531057 = cbrt(r531056);
        double r531058 = r531057 * r531057;
        double r531059 = r531058 * r531057;
        double r531060 = r531051 * r531059;
        double r531061 = fma(r531040, r531050, r531060);
        double r531062 = fma(r531032, r531033, r531061);
        double r531063 = 5.224383058243163e+120;
        bool r531064 = r531024 <= r531063;
        double r531065 = r531029 * r531035;
        double r531066 = r531024 * r531038;
        double r531067 = r531066 * r531035;
        double r531068 = -r531067;
        double r531069 = fma(r531065, r531034, r531068);
        double r531070 = fma(r531040, r531050, r531069);
        double r531071 = fma(r531032, r531033, r531070);
        double r531072 = r531064 ? r531071 : r531045;
        double r531073 = r531047 ? r531062 : r531072;
        double r531074 = r531026 ? r531045 : r531073;
        return r531074;
}

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.6
Herbie12.0
\[\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 a < -4.782074615948475e+103 or 5.224383058243163e+120 < a

    1. Initial program 21.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. Simplified21.0

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

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

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

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

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

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

    if -4.782074615948475e+103 < a < 2.496294686670284e-101

    1. Initial program 9.6

      \[\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. Simplified9.6

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

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

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

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

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

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

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

    if 2.496294686670284e-101 < a < 5.224383058243163e+120

    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. Simplified10.3

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -4.78207461594847479170920065988138565588 \cdot 10^{103}:\\ \;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, j, \left(z \cdot x\right) \cdot y - \mathsf{fma}\left(a, t \cdot x, z \cdot \left(c \cdot b\right)\right)\right)\\ \mathbf{elif}\;a \le 2.49629468667028412337712615225531683659 \cdot 10^{-101}:\\ \;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, j, \mathsf{fma}\left(b, \mathsf{fma}\left(i, t, c \cdot \left(-z\right)\right), \sqrt[3]{x} \cdot \left(\left(\sqrt[3]{\mathsf{fma}\left(y, z, t \cdot \left(-a\right)\right) \cdot \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right)} \cdot \sqrt[3]{\mathsf{fma}\left(y, z, t \cdot \left(-a\right)\right) \cdot \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right)}\right) \cdot \sqrt[3]{\mathsf{fma}\left(y, z, t \cdot \left(-a\right)\right) \cdot \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right)}\right)\right)\right)\\ \mathbf{elif}\;a \le 5.224383058243162557955086333333081930215 \cdot 10^{120}:\\ \;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, j, \mathsf{fma}\left(b, \mathsf{fma}\left(i, t, c \cdot \left(-z\right)\right), \mathsf{fma}\left(y \cdot x, z, -\left(a \cdot t\right) \cdot x\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, j, \left(z \cdot x\right) \cdot y - \mathsf{fma}\left(a, t \cdot x, z \cdot \left(c \cdot b\right)\right)\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019179 +o rules:numerics
(FPCore (x y z t a b c i j)
  :name "Data.Colour.Matrix:determinant from colour-2.3.3, A"

  :herbie-target
  (if (< x -1.469694296777705e-64) (+ (- (* x (- (* y z) (* t a))) (/ (* b (- (pow (* c z) 2.0) (pow (* t i) 2.0))) (+ (* 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.0) (pow (* t i) 2.0))) (+ (* c z) (* t i)))) (* j (- (* c a) (* y i))))))

  (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* t i)))) (* j (- (* c a) (* y i)))))