Average Error: 11.7 → 11.3
Time: 32.0s
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}\;b \le -7.739799318621917 \cdot 10^{-302}:\\ \;\;\;\;\mathsf{fma}\left(a \cdot c - y \cdot i, j, \mathsf{fma}\left(\sqrt[3]{t \cdot i - c \cdot z} \cdot \left(\sqrt[3]{t \cdot i - c \cdot z} \cdot \sqrt[3]{t \cdot i - c \cdot z}\right), b, \left(y \cdot z - a \cdot t\right) \cdot x\right)\right)\\ \mathbf{elif}\;b \le 2.6598888187366212 \cdot 10^{-112}:\\ \;\;\;\;\mathsf{fma}\left(a \cdot c - y \cdot i, j, z \cdot \left(x \cdot y - c \cdot b\right) - a \cdot \left(t \cdot x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a \cdot c - y \cdot i, j, \mathsf{fma}\left(\sqrt[3]{t \cdot i - c \cdot z} \cdot \left(\sqrt[3]{t \cdot i - c \cdot z} \cdot \sqrt[3]{t \cdot i - c \cdot z}\right), b, \left(y \cdot z - a \cdot t\right) \cdot x\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}\;b \le -7.739799318621917 \cdot 10^{-302}:\\
\;\;\;\;\mathsf{fma}\left(a \cdot c - y \cdot i, j, \mathsf{fma}\left(\sqrt[3]{t \cdot i - c \cdot z} \cdot \left(\sqrt[3]{t \cdot i - c \cdot z} \cdot \sqrt[3]{t \cdot i - c \cdot z}\right), b, \left(y \cdot z - a \cdot t\right) \cdot x\right)\right)\\

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a \cdot c - y \cdot i, j, \mathsf{fma}\left(\sqrt[3]{t \cdot i - c \cdot z} \cdot \left(\sqrt[3]{t \cdot i - c \cdot z} \cdot \sqrt[3]{t \cdot i - c \cdot z}\right), b, \left(y \cdot z - a \cdot t\right) \cdot x\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 r38074543 = x;
        double r38074544 = y;
        double r38074545 = z;
        double r38074546 = r38074544 * r38074545;
        double r38074547 = t;
        double r38074548 = a;
        double r38074549 = r38074547 * r38074548;
        double r38074550 = r38074546 - r38074549;
        double r38074551 = r38074543 * r38074550;
        double r38074552 = b;
        double r38074553 = c;
        double r38074554 = r38074553 * r38074545;
        double r38074555 = i;
        double r38074556 = r38074547 * r38074555;
        double r38074557 = r38074554 - r38074556;
        double r38074558 = r38074552 * r38074557;
        double r38074559 = r38074551 - r38074558;
        double r38074560 = j;
        double r38074561 = r38074553 * r38074548;
        double r38074562 = r38074544 * r38074555;
        double r38074563 = r38074561 - r38074562;
        double r38074564 = r38074560 * r38074563;
        double r38074565 = r38074559 + r38074564;
        return r38074565;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r38074566 = b;
        double r38074567 = -7.739799318621917e-302;
        bool r38074568 = r38074566 <= r38074567;
        double r38074569 = a;
        double r38074570 = c;
        double r38074571 = r38074569 * r38074570;
        double r38074572 = y;
        double r38074573 = i;
        double r38074574 = r38074572 * r38074573;
        double r38074575 = r38074571 - r38074574;
        double r38074576 = j;
        double r38074577 = t;
        double r38074578 = r38074577 * r38074573;
        double r38074579 = z;
        double r38074580 = r38074570 * r38074579;
        double r38074581 = r38074578 - r38074580;
        double r38074582 = cbrt(r38074581);
        double r38074583 = r38074582 * r38074582;
        double r38074584 = r38074582 * r38074583;
        double r38074585 = r38074572 * r38074579;
        double r38074586 = r38074569 * r38074577;
        double r38074587 = r38074585 - r38074586;
        double r38074588 = x;
        double r38074589 = r38074587 * r38074588;
        double r38074590 = fma(r38074584, r38074566, r38074589);
        double r38074591 = fma(r38074575, r38074576, r38074590);
        double r38074592 = 2.6598888187366212e-112;
        bool r38074593 = r38074566 <= r38074592;
        double r38074594 = r38074588 * r38074572;
        double r38074595 = r38074570 * r38074566;
        double r38074596 = r38074594 - r38074595;
        double r38074597 = r38074579 * r38074596;
        double r38074598 = r38074577 * r38074588;
        double r38074599 = r38074569 * r38074598;
        double r38074600 = r38074597 - r38074599;
        double r38074601 = fma(r38074575, r38074576, r38074600);
        double r38074602 = r38074593 ? r38074601 : r38074591;
        double r38074603 = r38074568 ? r38074591 : r38074602;
        return r38074603;
}

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.7
Target18.4
Herbie11.3
\[\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 b < -7.739799318621917e-302 or 2.6598888187366212e-112 < b

    1. Initial program 10.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. Simplified10.2

      \[\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 add-cube-cbrt10.5

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

    if -7.739799318621917e-302 < b < 2.6598888187366212e-112

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

      \[\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-neg17.0

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

      \[\leadsto \mathsf{fma}\left(a \cdot c - i \cdot y, 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)\]
    6. Simplified14.1

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

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

Reproduce

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