Average Error: 11.3 → 10.6
Time: 27.4s
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}\;z \le 4.706358930159526 \cdot 10^{+119}:\\ \;\;\;\;\left(a \cdot c - y \cdot i\right) \cdot j + \mathsf{fma}\left(t \cdot i - c \cdot z, b, \left(x \cdot \sqrt[3]{y \cdot z - t \cdot a}\right) \cdot \left(\sqrt[3]{y \cdot z - t \cdot a} \cdot \sqrt[3]{y \cdot z - t \cdot a}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(x \cdot y - b \cdot c\right) \cdot z - a \cdot \left(t \cdot x\right)\right) + \left(a \cdot c - y \cdot i\right) \cdot 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}\;z \le 4.706358930159526 \cdot 10^{+119}:\\
\;\;\;\;\left(a \cdot c - y \cdot i\right) \cdot j + \mathsf{fma}\left(t \cdot i - c \cdot z, b, \left(x \cdot \sqrt[3]{y \cdot z - t \cdot a}\right) \cdot \left(\sqrt[3]{y \cdot z - t \cdot a} \cdot \sqrt[3]{y \cdot z - t \cdot a}\right)\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r38031477 = x;
        double r38031478 = y;
        double r38031479 = z;
        double r38031480 = r38031478 * r38031479;
        double r38031481 = t;
        double r38031482 = a;
        double r38031483 = r38031481 * r38031482;
        double r38031484 = r38031480 - r38031483;
        double r38031485 = r38031477 * r38031484;
        double r38031486 = b;
        double r38031487 = c;
        double r38031488 = r38031487 * r38031479;
        double r38031489 = i;
        double r38031490 = r38031481 * r38031489;
        double r38031491 = r38031488 - r38031490;
        double r38031492 = r38031486 * r38031491;
        double r38031493 = r38031485 - r38031492;
        double r38031494 = j;
        double r38031495 = r38031487 * r38031482;
        double r38031496 = r38031478 * r38031489;
        double r38031497 = r38031495 - r38031496;
        double r38031498 = r38031494 * r38031497;
        double r38031499 = r38031493 + r38031498;
        return r38031499;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r38031500 = z;
        double r38031501 = 4.706358930159526e+119;
        bool r38031502 = r38031500 <= r38031501;
        double r38031503 = a;
        double r38031504 = c;
        double r38031505 = r38031503 * r38031504;
        double r38031506 = y;
        double r38031507 = i;
        double r38031508 = r38031506 * r38031507;
        double r38031509 = r38031505 - r38031508;
        double r38031510 = j;
        double r38031511 = r38031509 * r38031510;
        double r38031512 = t;
        double r38031513 = r38031512 * r38031507;
        double r38031514 = r38031504 * r38031500;
        double r38031515 = r38031513 - r38031514;
        double r38031516 = b;
        double r38031517 = x;
        double r38031518 = r38031506 * r38031500;
        double r38031519 = r38031512 * r38031503;
        double r38031520 = r38031518 - r38031519;
        double r38031521 = cbrt(r38031520);
        double r38031522 = r38031517 * r38031521;
        double r38031523 = r38031521 * r38031521;
        double r38031524 = r38031522 * r38031523;
        double r38031525 = fma(r38031515, r38031516, r38031524);
        double r38031526 = r38031511 + r38031525;
        double r38031527 = r38031517 * r38031506;
        double r38031528 = r38031516 * r38031504;
        double r38031529 = r38031527 - r38031528;
        double r38031530 = r38031529 * r38031500;
        double r38031531 = r38031512 * r38031517;
        double r38031532 = r38031503 * r38031531;
        double r38031533 = r38031530 - r38031532;
        double r38031534 = r38031533 + r38031511;
        double r38031535 = r38031502 ? r38031526 : r38031534;
        return r38031535;
}

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.3
Target19.3
Herbie10.6
\[\begin{array}{l} \mathbf{if}\;x \lt -1.469694296777705 \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 z < 4.706358930159526e+119

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

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

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

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

    if 4.706358930159526e+119 < z

    1. Initial program 20.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. Simplified20.3

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

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

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

      \[\leadsto \left(a \cdot c - i \cdot y\right) \cdot j + \color{blue}{\left(z \cdot \left(y \cdot x - c \cdot b\right) - a \cdot \left(t \cdot x\right)\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification10.6

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

Reproduce

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