Average Error: 12.5 → 11.6
Time: 25.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}\;b \le -4.743013838503683941195305672745042360023 \cdot 10^{-108}:\\ \;\;\;\;\mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, t \cdot i - c \cdot z, a \cdot \left(j \cdot c\right) + \left(-i \cdot \left(y \cdot j\right)\right)\right)\right)\\ \mathbf{elif}\;b \le 1.901057746895526582169217588485265050678 \cdot 10^{-125}:\\ \;\;\;\;\mathsf{fma}\left(x, \left(\sqrt[3]{y \cdot z - t \cdot a} \cdot \sqrt[3]{y \cdot z - t \cdot a}\right) \cdot \sqrt[3]{y \cdot z - t \cdot a}, c \cdot \left(a \cdot j - z \cdot b\right) - i \cdot \left(y \cdot j\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, t \cdot i - c \cdot z, \left(\sqrt[3]{j} \cdot \sqrt[3]{j}\right) \cdot \left(\sqrt[3]{j} \cdot \left(c \cdot a - y \cdot i\right)\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}\;b \le -4.743013838503683941195305672745042360023 \cdot 10^{-108}:\\
\;\;\;\;\mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, t \cdot i - c \cdot z, a \cdot \left(j \cdot c\right) + \left(-i \cdot \left(y \cdot j\right)\right)\right)\right)\\

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, t \cdot i - c \cdot z, \left(\sqrt[3]{j} \cdot \sqrt[3]{j}\right) \cdot \left(\sqrt[3]{j} \cdot \left(c \cdot a - y \cdot i\right)\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 r1234565 = x;
        double r1234566 = y;
        double r1234567 = z;
        double r1234568 = r1234566 * r1234567;
        double r1234569 = t;
        double r1234570 = a;
        double r1234571 = r1234569 * r1234570;
        double r1234572 = r1234568 - r1234571;
        double r1234573 = r1234565 * r1234572;
        double r1234574 = b;
        double r1234575 = c;
        double r1234576 = r1234575 * r1234567;
        double r1234577 = i;
        double r1234578 = r1234569 * r1234577;
        double r1234579 = r1234576 - r1234578;
        double r1234580 = r1234574 * r1234579;
        double r1234581 = r1234573 - r1234580;
        double r1234582 = j;
        double r1234583 = r1234575 * r1234570;
        double r1234584 = r1234566 * r1234577;
        double r1234585 = r1234583 - r1234584;
        double r1234586 = r1234582 * r1234585;
        double r1234587 = r1234581 + r1234586;
        return r1234587;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r1234588 = b;
        double r1234589 = -4.743013838503684e-108;
        bool r1234590 = r1234588 <= r1234589;
        double r1234591 = x;
        double r1234592 = y;
        double r1234593 = z;
        double r1234594 = r1234592 * r1234593;
        double r1234595 = t;
        double r1234596 = a;
        double r1234597 = r1234595 * r1234596;
        double r1234598 = r1234594 - r1234597;
        double r1234599 = i;
        double r1234600 = r1234595 * r1234599;
        double r1234601 = c;
        double r1234602 = r1234601 * r1234593;
        double r1234603 = r1234600 - r1234602;
        double r1234604 = j;
        double r1234605 = r1234604 * r1234601;
        double r1234606 = r1234596 * r1234605;
        double r1234607 = r1234592 * r1234604;
        double r1234608 = r1234599 * r1234607;
        double r1234609 = -r1234608;
        double r1234610 = r1234606 + r1234609;
        double r1234611 = fma(r1234588, r1234603, r1234610);
        double r1234612 = fma(r1234591, r1234598, r1234611);
        double r1234613 = 1.9010577468955266e-125;
        bool r1234614 = r1234588 <= r1234613;
        double r1234615 = cbrt(r1234598);
        double r1234616 = r1234615 * r1234615;
        double r1234617 = r1234616 * r1234615;
        double r1234618 = r1234596 * r1234604;
        double r1234619 = r1234593 * r1234588;
        double r1234620 = r1234618 - r1234619;
        double r1234621 = r1234601 * r1234620;
        double r1234622 = r1234621 - r1234608;
        double r1234623 = fma(r1234591, r1234617, r1234622);
        double r1234624 = cbrt(r1234604);
        double r1234625 = r1234624 * r1234624;
        double r1234626 = r1234601 * r1234596;
        double r1234627 = r1234592 * r1234599;
        double r1234628 = r1234626 - r1234627;
        double r1234629 = r1234624 * r1234628;
        double r1234630 = r1234625 * r1234629;
        double r1234631 = fma(r1234588, r1234603, r1234630);
        double r1234632 = fma(r1234591, r1234598, r1234631);
        double r1234633 = r1234614 ? r1234623 : r1234632;
        double r1234634 = r1234590 ? r1234612 : r1234633;
        return r1234634;
}

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.5
Target19.9
Herbie11.6
\[\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 b < -4.743013838503684e-108

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

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

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

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

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

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

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

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

    if -4.743013838503684e-108 < b < 1.9010577468955266e-125

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

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

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

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

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

    if 1.9010577468955266e-125 < b

    1. Initial program 9.5

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

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

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

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

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

Reproduce

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

  :herbie-target
  (if (< x -1.46969429677770502e-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)))))