Average Error: 12.3 → 10.4
Time: 31.2s
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 -2.148294655559022721785844990352181458387 \cdot 10^{74} \lor \neg \left(z \le 4625666946584051459611692871641645220626000\right):\\ \;\;\;\;\mathsf{fma}\left(t \cdot c - y \cdot i, j, \mathsf{fma}\left(a, -x \cdot t, z \cdot \left(x \cdot y - b \cdot c\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\sqrt[3]{\mathsf{fma}\left(i, -y, t \cdot c\right)} \cdot \left(\sqrt[3]{\mathsf{fma}\left(i, -y, t \cdot c\right)} \cdot \sqrt[3]{\mathsf{fma}\left(i, -y, t \cdot c\right)}\right), j, \mathsf{fma}\left(b, a \cdot i - c \cdot z, \mathsf{fma}\left(-a, t, y \cdot z\right) \cdot x\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 -2.148294655559022721785844990352181458387 \cdot 10^{74} \lor \neg \left(z \le 4625666946584051459611692871641645220626000\right):\\
\;\;\;\;\mathsf{fma}\left(t \cdot c - y \cdot i, j, \mathsf{fma}\left(a, -x \cdot t, z \cdot \left(x \cdot y - b \cdot c\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sqrt[3]{\mathsf{fma}\left(i, -y, t \cdot c\right)} \cdot \left(\sqrt[3]{\mathsf{fma}\left(i, -y, t \cdot c\right)} \cdot \sqrt[3]{\mathsf{fma}\left(i, -y, t \cdot c\right)}\right), j, \mathsf{fma}\left(b, a \cdot i - c \cdot z, \mathsf{fma}\left(-a, t, y \cdot z\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 r516462 = x;
        double r516463 = y;
        double r516464 = z;
        double r516465 = r516463 * r516464;
        double r516466 = t;
        double r516467 = a;
        double r516468 = r516466 * r516467;
        double r516469 = r516465 - r516468;
        double r516470 = r516462 * r516469;
        double r516471 = b;
        double r516472 = c;
        double r516473 = r516472 * r516464;
        double r516474 = i;
        double r516475 = r516474 * r516467;
        double r516476 = r516473 - r516475;
        double r516477 = r516471 * r516476;
        double r516478 = r516470 - r516477;
        double r516479 = j;
        double r516480 = r516472 * r516466;
        double r516481 = r516474 * r516463;
        double r516482 = r516480 - r516481;
        double r516483 = r516479 * r516482;
        double r516484 = r516478 + r516483;
        return r516484;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r516485 = z;
        double r516486 = -2.1482946555590227e+74;
        bool r516487 = r516485 <= r516486;
        double r516488 = 4.6256669465840515e+42;
        bool r516489 = r516485 <= r516488;
        double r516490 = !r516489;
        bool r516491 = r516487 || r516490;
        double r516492 = t;
        double r516493 = c;
        double r516494 = r516492 * r516493;
        double r516495 = y;
        double r516496 = i;
        double r516497 = r516495 * r516496;
        double r516498 = r516494 - r516497;
        double r516499 = j;
        double r516500 = a;
        double r516501 = x;
        double r516502 = r516501 * r516492;
        double r516503 = -r516502;
        double r516504 = r516501 * r516495;
        double r516505 = b;
        double r516506 = r516505 * r516493;
        double r516507 = r516504 - r516506;
        double r516508 = r516485 * r516507;
        double r516509 = fma(r516500, r516503, r516508);
        double r516510 = fma(r516498, r516499, r516509);
        double r516511 = -r516495;
        double r516512 = fma(r516496, r516511, r516494);
        double r516513 = cbrt(r516512);
        double r516514 = r516513 * r516513;
        double r516515 = r516513 * r516514;
        double r516516 = r516500 * r516496;
        double r516517 = r516493 * r516485;
        double r516518 = r516516 - r516517;
        double r516519 = -r516500;
        double r516520 = r516495 * r516485;
        double r516521 = fma(r516519, r516492, r516520);
        double r516522 = r516521 * r516501;
        double r516523 = fma(r516505, r516518, r516522);
        double r516524 = fma(r516515, r516499, r516523);
        double r516525 = r516491 ? r516510 : r516524;
        return r516525;
}

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.0
Herbie10.4
\[\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 2 regimes
  2. if z < -2.1482946555590227e+74 or 4.6256669465840515e+42 < z

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

      \[\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 18.9

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

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

    if -2.1482946555590227e+74 < z < 4.6256669465840515e+42

    1. Initial program 9.1

      \[\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. Simplified9.1

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

      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\sqrt[3]{t \cdot c - i \cdot y} \cdot \sqrt[3]{t \cdot c - i \cdot y}\right) \cdot \sqrt[3]{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)\]
    5. Simplified9.5

      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\sqrt[3]{\mathsf{fma}\left(i, -y, c \cdot t\right)} \cdot \sqrt[3]{\mathsf{fma}\left(i, -y, c \cdot t\right)}\right)} \cdot \sqrt[3]{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)\]
    6. Simplified9.5

      \[\leadsto \mathsf{fma}\left(\left(\sqrt[3]{\mathsf{fma}\left(i, -y, c \cdot t\right)} \cdot \sqrt[3]{\mathsf{fma}\left(i, -y, c \cdot t\right)}\right) \cdot \color{blue}{\sqrt[3]{\mathsf{fma}\left(i, -y, c \cdot t\right)}}, 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. Recombined 2 regimes into one program.
  4. Final simplification10.4

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

Reproduce

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