Average Error: 12.3 → 13.3
Time: 31.4s
Precision: 64
\[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)\]
\[\begin{array}{l} \mathbf{if}\;z \le 1.216221941101978796314790756047194640043 \cdot 10^{174}:\\ \;\;\;\;\mathsf{fma}\left(t \cdot c - y \cdot i, j, \mathsf{fma}\left(b, a \cdot i - c \cdot z, \left(x \cdot \sqrt[3]{\mathsf{fma}\left(t, -a, y \cdot z\right)}\right) \cdot \left(\sqrt[3]{\mathsf{fma}\left(-a, t, y \cdot z\right)} \cdot \sqrt[3]{\mathsf{fma}\left(-a, t, y \cdot z\right)}\right)\right)\right)\\ \mathbf{elif}\;z \le 5.648934867938140442590265463133244775988 \cdot 10^{209}:\\ \;\;\;\;\mathsf{fma}\left(i, \mathsf{fma}\left(a, b, -y \cdot j\right), \left(b \cdot c\right) \cdot \left(-z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(-z\right) \cdot b, c, x \cdot \mathsf{fma}\left(t, -a, y \cdot z\right)\right)\\ \end{array}\]
\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)
\begin{array}{l}
\mathbf{if}\;z \le 1.216221941101978796314790756047194640043 \cdot 10^{174}:\\
\;\;\;\;\mathsf{fma}\left(t \cdot c - y \cdot i, j, \mathsf{fma}\left(b, a \cdot i - c \cdot z, \left(x \cdot \sqrt[3]{\mathsf{fma}\left(t, -a, y \cdot z\right)}\right) \cdot \left(\sqrt[3]{\mathsf{fma}\left(-a, t, y \cdot z\right)} \cdot \sqrt[3]{\mathsf{fma}\left(-a, t, y \cdot z\right)}\right)\right)\right)\\

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(-z\right) \cdot b, c, x \cdot \mathsf{fma}\left(t, -a, y \cdot z\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 r458540 = x;
        double r458541 = y;
        double r458542 = z;
        double r458543 = r458541 * r458542;
        double r458544 = t;
        double r458545 = a;
        double r458546 = r458544 * r458545;
        double r458547 = r458543 - r458546;
        double r458548 = r458540 * r458547;
        double r458549 = b;
        double r458550 = c;
        double r458551 = r458550 * r458542;
        double r458552 = i;
        double r458553 = r458552 * r458545;
        double r458554 = r458551 - r458553;
        double r458555 = r458549 * r458554;
        double r458556 = r458548 - r458555;
        double r458557 = j;
        double r458558 = r458550 * r458544;
        double r458559 = r458552 * r458541;
        double r458560 = r458558 - r458559;
        double r458561 = r458557 * r458560;
        double r458562 = r458556 + r458561;
        return r458562;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r458563 = z;
        double r458564 = 1.2162219411019788e+174;
        bool r458565 = r458563 <= r458564;
        double r458566 = t;
        double r458567 = c;
        double r458568 = r458566 * r458567;
        double r458569 = y;
        double r458570 = i;
        double r458571 = r458569 * r458570;
        double r458572 = r458568 - r458571;
        double r458573 = j;
        double r458574 = b;
        double r458575 = a;
        double r458576 = r458575 * r458570;
        double r458577 = r458567 * r458563;
        double r458578 = r458576 - r458577;
        double r458579 = x;
        double r458580 = -r458575;
        double r458581 = r458569 * r458563;
        double r458582 = fma(r458566, r458580, r458581);
        double r458583 = cbrt(r458582);
        double r458584 = r458579 * r458583;
        double r458585 = fma(r458580, r458566, r458581);
        double r458586 = cbrt(r458585);
        double r458587 = r458586 * r458586;
        double r458588 = r458584 * r458587;
        double r458589 = fma(r458574, r458578, r458588);
        double r458590 = fma(r458572, r458573, r458589);
        double r458591 = 5.6489348679381404e+209;
        bool r458592 = r458563 <= r458591;
        double r458593 = r458569 * r458573;
        double r458594 = -r458593;
        double r458595 = fma(r458575, r458574, r458594);
        double r458596 = r458574 * r458567;
        double r458597 = -r458563;
        double r458598 = r458596 * r458597;
        double r458599 = fma(r458570, r458595, r458598);
        double r458600 = r458597 * r458574;
        double r458601 = r458579 * r458582;
        double r458602 = fma(r458600, r458567, r458601);
        double r458603 = r458592 ? r458599 : r458602;
        double r458604 = r458565 ? r458590 : r458603;
        return r458604;
}

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
Target16.1
Herbie13.3
\[\begin{array}{l} \mathbf{if}\;t \lt -8.12097891919591218149793027759825150959 \cdot 10^{-33}:\\ \;\;\;\;x \cdot \left(z \cdot y - a \cdot t\right) - \left(b \cdot \left(z \cdot c - a \cdot i\right) - \left(c \cdot t - y \cdot i\right) \cdot j\right)\\ \mathbf{elif}\;t \lt -4.712553818218485141757938537793350881052 \cdot 10^{-169}:\\ \;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + \frac{j \cdot \left({\left(c \cdot t\right)}^{2} - {\left(i \cdot y\right)}^{2}\right)}{c \cdot t + i \cdot y}\\ \mathbf{elif}\;t \lt -7.633533346031583686060259351057142920433 \cdot 10^{-308}:\\ \;\;\;\;x \cdot \left(z \cdot y - a \cdot t\right) - \left(b \cdot \left(z \cdot c - a \cdot i\right) - \left(c \cdot t - y \cdot i\right) \cdot j\right)\\ \mathbf{elif}\;t \lt 1.053588855745548710002760210539645467715 \cdot 10^{-139}:\\ \;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + \frac{j \cdot \left({\left(c \cdot t\right)}^{2} - {\left(i \cdot y\right)}^{2}\right)}{c \cdot t + i \cdot y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z \cdot y - a \cdot t\right) - \left(b \cdot \left(z \cdot c - a \cdot i\right) - \left(c \cdot t - y \cdot i\right) \cdot j\right)\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if z < 1.2162219411019788e+174

    1. Initial program 11.5

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)\]
    2. Simplified11.5

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

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

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

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

    if 1.2162219411019788e+174 < z < 5.6489348679381404e+209

    1. Initial program 22.3

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)\]
    2. Simplified22.4

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

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

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

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

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

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

    if 5.6489348679381404e+209 < z

    1. Initial program 24.7

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)\]
    2. Simplified24.7

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

      \[\leadsto \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)}\]
    4. Simplified34.7

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

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

Reproduce

herbie shell --seed 2019196 +o rules:numerics
(FPCore (x y z t a b c i j)
  :name "Linear.Matrix:det33 from linear-1.19.1.3"

  :herbie-target
  (if (< t -8.120978919195912e-33) (- (* x (- (* z y) (* a t))) (- (* b (- (* z c) (* a i))) (* (- (* c t) (* y i)) j))) (if (< t -4.712553818218485e-169) (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a)))) (/ (* j (- (pow (* c t) 2.0) (pow (* i y) 2.0))) (+ (* c t) (* i y)))) (if (< t -7.633533346031584e-308) (- (* x (- (* z y) (* a t))) (- (* b (- (* z c) (* a i))) (* (- (* c t) (* y i)) j))) (if (< t 1.0535888557455487e-139) (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a)))) (/ (* j (- (pow (* c t) 2.0) (pow (* i y) 2.0))) (+ (* c t) (* i y)))) (- (* x (- (* z y) (* a t))) (- (* b (- (* z c) (* a i))) (* (- (* c t) (* y i)) j)))))))

  (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a)))) (* j (- (* c t) (* i y)))))