Average Error: 12.3 → 9.8
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}\;j \le -7.426419963249853361219422223192527763444 \cdot 10^{76}:\\ \;\;\;\;\left(a \cdot c - i \cdot y\right) \cdot j + \left(\sqrt[3]{\mathsf{fma}\left(b, t \cdot i - z \cdot c, \left(z \cdot y - t \cdot a\right) \cdot x\right)} \cdot \sqrt[3]{\mathsf{fma}\left(b, t \cdot i - z \cdot c, \left(z \cdot y - t \cdot a\right) \cdot x\right)}\right) \cdot \sqrt[3]{\mathsf{fma}\left(b, t \cdot i - z \cdot c, \left(z \cdot y - t \cdot a\right) \cdot x\right)}\\ \mathbf{elif}\;j \le 1.613592276650847279046100377055682446527 \cdot 10^{-83}:\\ \;\;\;\;\mathsf{fma}\left(b, t \cdot i - z \cdot c, \left(z \cdot y - t \cdot a\right) \cdot x\right) + \left(a \cdot \left(c \cdot j\right) - i \cdot \left(j \cdot y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(b, t \cdot i - z \cdot c, \left(z \cdot y - t \cdot a\right) \cdot x\right) + \left(\sqrt[3]{\sqrt[3]{j} \cdot \sqrt[3]{j}} \cdot \left(\left(\sqrt[3]{j} \cdot \sqrt[3]{j}\right) \cdot \left(a \cdot c - i \cdot y\right)\right)\right) \cdot \sqrt[3]{\sqrt[3]{j}}\\ \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 -7.426419963249853361219422223192527763444 \cdot 10^{76}:\\
\;\;\;\;\left(a \cdot c - i \cdot y\right) \cdot j + \left(\sqrt[3]{\mathsf{fma}\left(b, t \cdot i - z \cdot c, \left(z \cdot y - t \cdot a\right) \cdot x\right)} \cdot \sqrt[3]{\mathsf{fma}\left(b, t \cdot i - z \cdot c, \left(z \cdot y - t \cdot a\right) \cdot x\right)}\right) \cdot \sqrt[3]{\mathsf{fma}\left(b, t \cdot i - z \cdot c, \left(z \cdot y - t \cdot a\right) \cdot x\right)}\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r38588187 = x;
        double r38588188 = y;
        double r38588189 = z;
        double r38588190 = r38588188 * r38588189;
        double r38588191 = t;
        double r38588192 = a;
        double r38588193 = r38588191 * r38588192;
        double r38588194 = r38588190 - r38588193;
        double r38588195 = r38588187 * r38588194;
        double r38588196 = b;
        double r38588197 = c;
        double r38588198 = r38588197 * r38588189;
        double r38588199 = i;
        double r38588200 = r38588191 * r38588199;
        double r38588201 = r38588198 - r38588200;
        double r38588202 = r38588196 * r38588201;
        double r38588203 = r38588195 - r38588202;
        double r38588204 = j;
        double r38588205 = r38588197 * r38588192;
        double r38588206 = r38588188 * r38588199;
        double r38588207 = r38588205 - r38588206;
        double r38588208 = r38588204 * r38588207;
        double r38588209 = r38588203 + r38588208;
        return r38588209;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r38588210 = j;
        double r38588211 = -7.426419963249853e+76;
        bool r38588212 = r38588210 <= r38588211;
        double r38588213 = a;
        double r38588214 = c;
        double r38588215 = r38588213 * r38588214;
        double r38588216 = i;
        double r38588217 = y;
        double r38588218 = r38588216 * r38588217;
        double r38588219 = r38588215 - r38588218;
        double r38588220 = r38588219 * r38588210;
        double r38588221 = b;
        double r38588222 = t;
        double r38588223 = r38588222 * r38588216;
        double r38588224 = z;
        double r38588225 = r38588224 * r38588214;
        double r38588226 = r38588223 - r38588225;
        double r38588227 = r38588224 * r38588217;
        double r38588228 = r38588222 * r38588213;
        double r38588229 = r38588227 - r38588228;
        double r38588230 = x;
        double r38588231 = r38588229 * r38588230;
        double r38588232 = fma(r38588221, r38588226, r38588231);
        double r38588233 = cbrt(r38588232);
        double r38588234 = r38588233 * r38588233;
        double r38588235 = r38588234 * r38588233;
        double r38588236 = r38588220 + r38588235;
        double r38588237 = 1.6135922766508473e-83;
        bool r38588238 = r38588210 <= r38588237;
        double r38588239 = r38588214 * r38588210;
        double r38588240 = r38588213 * r38588239;
        double r38588241 = r38588210 * r38588217;
        double r38588242 = r38588216 * r38588241;
        double r38588243 = r38588240 - r38588242;
        double r38588244 = r38588232 + r38588243;
        double r38588245 = cbrt(r38588210);
        double r38588246 = r38588245 * r38588245;
        double r38588247 = cbrt(r38588246);
        double r38588248 = r38588246 * r38588219;
        double r38588249 = r38588247 * r38588248;
        double r38588250 = cbrt(r38588245);
        double r38588251 = r38588249 * r38588250;
        double r38588252 = r38588232 + r38588251;
        double r38588253 = r38588238 ? r38588244 : r38588252;
        double r38588254 = r38588212 ? r38588236 : r38588253;
        return r38588254;
}

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.3
Target20.2
Herbie9.8
\[\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 j < -7.426419963249853e+76

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

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

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

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

    if -7.426419963249853e+76 < j < 1.6135922766508473e-83

    1. Initial program 15.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. Simplified15.3

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

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

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

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

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

    if 1.6135922766508473e-83 < j

    1. Initial program 7.9

      \[\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. Simplified7.9

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

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

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

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

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

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

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

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

Reproduce

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