Average Error: 12.8 → 11.8
Time: 1.3m
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.327033599359954 \cdot 10^{+156}:\\ \;\;\;\;\mathsf{fma}\left(t \cdot c - y \cdot i, j, \left(x \cdot y - c \cdot b\right) \cdot z - \left(t \cdot x\right) \cdot a\right)\\ \mathbf{elif}\;z \le 1.2230243741272296 \cdot 10^{-48}:\\ \;\;\;\;\mathsf{fma}\left(t \cdot c - y \cdot i, j, \mathsf{fma}\left(i \cdot a - c \cdot z, b, \left(\left(y \cdot z - t \cdot a\right) \cdot \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right)\right) \cdot \sqrt[3]{x}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t \cdot c - y \cdot i, j, \left(x \cdot y - c \cdot b\right) \cdot z - \left(t \cdot x\right) \cdot a\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.327033599359954 \cdot 10^{+156}:\\
\;\;\;\;\mathsf{fma}\left(t \cdot c - y \cdot i, j, \left(x \cdot y - c \cdot b\right) \cdot z - \left(t \cdot x\right) \cdot a\right)\\

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t \cdot c - y \cdot i, j, \left(x \cdot y - c \cdot b\right) \cdot z - \left(t \cdot x\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 r17971675 = x;
        double r17971676 = y;
        double r17971677 = z;
        double r17971678 = r17971676 * r17971677;
        double r17971679 = t;
        double r17971680 = a;
        double r17971681 = r17971679 * r17971680;
        double r17971682 = r17971678 - r17971681;
        double r17971683 = r17971675 * r17971682;
        double r17971684 = b;
        double r17971685 = c;
        double r17971686 = r17971685 * r17971677;
        double r17971687 = i;
        double r17971688 = r17971687 * r17971680;
        double r17971689 = r17971686 - r17971688;
        double r17971690 = r17971684 * r17971689;
        double r17971691 = r17971683 - r17971690;
        double r17971692 = j;
        double r17971693 = r17971685 * r17971679;
        double r17971694 = r17971687 * r17971676;
        double r17971695 = r17971693 - r17971694;
        double r17971696 = r17971692 * r17971695;
        double r17971697 = r17971691 + r17971696;
        return r17971697;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r17971698 = z;
        double r17971699 = -1.327033599359954e+156;
        bool r17971700 = r17971698 <= r17971699;
        double r17971701 = t;
        double r17971702 = c;
        double r17971703 = r17971701 * r17971702;
        double r17971704 = y;
        double r17971705 = i;
        double r17971706 = r17971704 * r17971705;
        double r17971707 = r17971703 - r17971706;
        double r17971708 = j;
        double r17971709 = x;
        double r17971710 = r17971709 * r17971704;
        double r17971711 = b;
        double r17971712 = r17971702 * r17971711;
        double r17971713 = r17971710 - r17971712;
        double r17971714 = r17971713 * r17971698;
        double r17971715 = r17971701 * r17971709;
        double r17971716 = a;
        double r17971717 = r17971715 * r17971716;
        double r17971718 = r17971714 - r17971717;
        double r17971719 = fma(r17971707, r17971708, r17971718);
        double r17971720 = 1.2230243741272296e-48;
        bool r17971721 = r17971698 <= r17971720;
        double r17971722 = r17971705 * r17971716;
        double r17971723 = r17971702 * r17971698;
        double r17971724 = r17971722 - r17971723;
        double r17971725 = r17971704 * r17971698;
        double r17971726 = r17971701 * r17971716;
        double r17971727 = r17971725 - r17971726;
        double r17971728 = cbrt(r17971709);
        double r17971729 = r17971728 * r17971728;
        double r17971730 = r17971727 * r17971729;
        double r17971731 = r17971730 * r17971728;
        double r17971732 = fma(r17971724, r17971711, r17971731);
        double r17971733 = fma(r17971707, r17971708, r17971732);
        double r17971734 = r17971721 ? r17971733 : r17971719;
        double r17971735 = r17971700 ? r17971719 : r17971734;
        return r17971735;
}

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.8
Target17.0
Herbie11.8
\[\begin{array}{l} \mathbf{if}\;t \lt -8.120978919195912 \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.712553818218485 \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.0} - {\left(i \cdot y\right)}^{2.0}\right)}{c \cdot t + i \cdot y}\\ \mathbf{elif}\;t \lt -7.633533346031584 \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.0535888557455487 \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.0} - {\left(i \cdot y\right)}^{2.0}\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 < -1.327033599359954e+156 or 1.2230243741272296e-48 < z

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

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

      \[\leadsto \mathsf{fma}\left(t \cdot c - i \cdot y, j, \mathsf{fma}\left(i \cdot a - z \cdot c, b, \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*17.8

      \[\leadsto \mathsf{fma}\left(t \cdot c - i \cdot y, j, \mathsf{fma}\left(i \cdot a - z \cdot c, b, \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. 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)\]
    7. Simplified14.5

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

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

    if -1.327033599359954e+156 < z < 1.2230243741272296e-48

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(t \cdot c - i \cdot y, j, \mathsf{fma}\left(i \cdot a - 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.8

      \[\leadsto \mathsf{fma}\left(t \cdot c - i \cdot y, j, \mathsf{fma}\left(i \cdot a - z \cdot c, b, \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*10.8

      \[\leadsto \mathsf{fma}\left(t \cdot c - i \cdot y, j, \mathsf{fma}\left(i \cdot a - z \cdot c, b, \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)\]
  3. Recombined 2 regimes into one program.
  4. Final simplification11.8

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

Reproduce

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