Average Error: 11.9 → 11.4
Time: 30.6s
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 -3.407685349478973715298670290886295491532 \cdot 10^{94}:\\ \;\;\;\;\mathsf{fma}\left(a \cdot c - i \cdot y, j, \left(x \cdot y\right) \cdot z - \mathsf{fma}\left(z \cdot b, c, \left(a \cdot x\right) \cdot t\right)\right)\\ \mathbf{elif}\;z \le 8.503750271529326218229533536403852555216 \cdot 10^{57}:\\ \;\;\;\;\left(\sqrt[3]{\mathsf{fma}\left(a \cdot c - i \cdot y, j, \mathsf{fma}\left(b, t \cdot i - c \cdot z, \left(z \cdot y - a \cdot t\right) \cdot x\right)\right)} \cdot \sqrt[3]{\mathsf{fma}\left(a \cdot c - i \cdot y, j, \mathsf{fma}\left(b, t \cdot i - c \cdot z, \left(z \cdot y - a \cdot t\right) \cdot x\right)\right)}\right) \cdot \sqrt[3]{\mathsf{fma}\left(a \cdot c - i \cdot y, j, \mathsf{fma}\left(b, t \cdot i - c \cdot z, \left(z \cdot y - a \cdot t\right) \cdot x\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a \cdot c - i \cdot y, j, \left(x \cdot y - b \cdot c\right) \cdot z - \left(x \cdot t\right) \cdot a\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}\;z \le -3.407685349478973715298670290886295491532 \cdot 10^{94}:\\
\;\;\;\;\mathsf{fma}\left(a \cdot c - i \cdot y, j, \left(x \cdot y\right) \cdot z - \mathsf{fma}\left(z \cdot b, c, \left(a \cdot x\right) \cdot t\right)\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r34927605 = x;
        double r34927606 = y;
        double r34927607 = z;
        double r34927608 = r34927606 * r34927607;
        double r34927609 = t;
        double r34927610 = a;
        double r34927611 = r34927609 * r34927610;
        double r34927612 = r34927608 - r34927611;
        double r34927613 = r34927605 * r34927612;
        double r34927614 = b;
        double r34927615 = c;
        double r34927616 = r34927615 * r34927607;
        double r34927617 = i;
        double r34927618 = r34927609 * r34927617;
        double r34927619 = r34927616 - r34927618;
        double r34927620 = r34927614 * r34927619;
        double r34927621 = r34927613 - r34927620;
        double r34927622 = j;
        double r34927623 = r34927615 * r34927610;
        double r34927624 = r34927606 * r34927617;
        double r34927625 = r34927623 - r34927624;
        double r34927626 = r34927622 * r34927625;
        double r34927627 = r34927621 + r34927626;
        return r34927627;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r34927628 = z;
        double r34927629 = -3.407685349478974e+94;
        bool r34927630 = r34927628 <= r34927629;
        double r34927631 = a;
        double r34927632 = c;
        double r34927633 = r34927631 * r34927632;
        double r34927634 = i;
        double r34927635 = y;
        double r34927636 = r34927634 * r34927635;
        double r34927637 = r34927633 - r34927636;
        double r34927638 = j;
        double r34927639 = x;
        double r34927640 = r34927639 * r34927635;
        double r34927641 = r34927640 * r34927628;
        double r34927642 = b;
        double r34927643 = r34927628 * r34927642;
        double r34927644 = r34927631 * r34927639;
        double r34927645 = t;
        double r34927646 = r34927644 * r34927645;
        double r34927647 = fma(r34927643, r34927632, r34927646);
        double r34927648 = r34927641 - r34927647;
        double r34927649 = fma(r34927637, r34927638, r34927648);
        double r34927650 = 8.503750271529326e+57;
        bool r34927651 = r34927628 <= r34927650;
        double r34927652 = r34927645 * r34927634;
        double r34927653 = r34927632 * r34927628;
        double r34927654 = r34927652 - r34927653;
        double r34927655 = r34927628 * r34927635;
        double r34927656 = r34927631 * r34927645;
        double r34927657 = r34927655 - r34927656;
        double r34927658 = r34927657 * r34927639;
        double r34927659 = fma(r34927642, r34927654, r34927658);
        double r34927660 = fma(r34927637, r34927638, r34927659);
        double r34927661 = cbrt(r34927660);
        double r34927662 = r34927661 * r34927661;
        double r34927663 = r34927662 * r34927661;
        double r34927664 = r34927642 * r34927632;
        double r34927665 = r34927640 - r34927664;
        double r34927666 = r34927665 * r34927628;
        double r34927667 = r34927639 * r34927645;
        double r34927668 = r34927667 * r34927631;
        double r34927669 = r34927666 - r34927668;
        double r34927670 = fma(r34927637, r34927638, r34927669);
        double r34927671 = r34927651 ? r34927663 : r34927670;
        double r34927672 = r34927630 ? r34927649 : r34927671;
        return r34927672;
}

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.9
Target19.7
Herbie11.4
\[\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 z < -3.407685349478974e+94

    1. Initial program 19.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. Simplified19.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 add-cube-cbrt20.1

      \[\leadsto \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 \color{blue}{\left(\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}\right)}\right)\right)\]
    5. Applied associate-*r*20.1

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

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

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

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

      \[\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)\]
    11. Simplified18.8

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

    if -3.407685349478974e+94 < z < 8.503750271529326e+57

    1. Initial program 9.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. Simplified9.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 add-cube-cbrt10.2

      \[\leadsto \color{blue}{\left(\sqrt[3]{\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)} \cdot \sqrt[3]{\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)}\right) \cdot \sqrt[3]{\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)}}\]

    if 8.503750271529326e+57 < z

    1. Initial program 18.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. Simplified18.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 add-cube-cbrt18.6

      \[\leadsto \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 \color{blue}{\left(\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}\right)}\right)\right)\]
    5. Applied associate-*r*18.6

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

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

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

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

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

      \[\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)\]
    12. Simplified11.3

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

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

Reproduce

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