Average Error: 12.0 → 12.1
Time: 34.7s
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 9.242667919964829558492511784649235589271 \cdot 10^{144}:\\ \;\;\;\;\mathsf{fma}\left(t \cdot c - y \cdot i, j, \mathsf{fma}\left(a \cdot i - c \cdot z, b, \left(\sqrt[3]{y \cdot z - t \cdot a} \cdot \left(\sqrt[3]{y \cdot z - t \cdot a} \cdot \sqrt[3]{y \cdot z - t \cdot a}\right)\right) \cdot x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(x \cdot y - c \cdot b\right) - \left(t \cdot a\right) \cdot x\\ \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 9.242667919964829558492511784649235589271 \cdot 10^{144}:\\
\;\;\;\;\mathsf{fma}\left(t \cdot c - y \cdot i, j, \mathsf{fma}\left(a \cdot i - c \cdot z, b, \left(\sqrt[3]{y \cdot z - t \cdot a} \cdot \left(\sqrt[3]{y \cdot z - t \cdot a} \cdot \sqrt[3]{y \cdot z - t \cdot a}\right)\right) \cdot x\right)\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r28021977 = x;
        double r28021978 = y;
        double r28021979 = z;
        double r28021980 = r28021978 * r28021979;
        double r28021981 = t;
        double r28021982 = a;
        double r28021983 = r28021981 * r28021982;
        double r28021984 = r28021980 - r28021983;
        double r28021985 = r28021977 * r28021984;
        double r28021986 = b;
        double r28021987 = c;
        double r28021988 = r28021987 * r28021979;
        double r28021989 = i;
        double r28021990 = r28021989 * r28021982;
        double r28021991 = r28021988 - r28021990;
        double r28021992 = r28021986 * r28021991;
        double r28021993 = r28021985 - r28021992;
        double r28021994 = j;
        double r28021995 = r28021987 * r28021981;
        double r28021996 = r28021989 * r28021978;
        double r28021997 = r28021995 - r28021996;
        double r28021998 = r28021994 * r28021997;
        double r28021999 = r28021993 + r28021998;
        return r28021999;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r28022000 = z;
        double r28022001 = 9.24266791996483e+144;
        bool r28022002 = r28022000 <= r28022001;
        double r28022003 = t;
        double r28022004 = c;
        double r28022005 = r28022003 * r28022004;
        double r28022006 = y;
        double r28022007 = i;
        double r28022008 = r28022006 * r28022007;
        double r28022009 = r28022005 - r28022008;
        double r28022010 = j;
        double r28022011 = a;
        double r28022012 = r28022011 * r28022007;
        double r28022013 = r28022004 * r28022000;
        double r28022014 = r28022012 - r28022013;
        double r28022015 = b;
        double r28022016 = r28022006 * r28022000;
        double r28022017 = r28022003 * r28022011;
        double r28022018 = r28022016 - r28022017;
        double r28022019 = cbrt(r28022018);
        double r28022020 = r28022019 * r28022019;
        double r28022021 = r28022019 * r28022020;
        double r28022022 = x;
        double r28022023 = r28022021 * r28022022;
        double r28022024 = fma(r28022014, r28022015, r28022023);
        double r28022025 = fma(r28022009, r28022010, r28022024);
        double r28022026 = r28022022 * r28022006;
        double r28022027 = r28022004 * r28022015;
        double r28022028 = r28022026 - r28022027;
        double r28022029 = r28022000 * r28022028;
        double r28022030 = r28022017 * r28022022;
        double r28022031 = r28022029 - r28022030;
        double r28022032 = r28022002 ? r28022025 : r28022031;
        return r28022032;
}

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.0
Target15.7
Herbie12.1
\[\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 < 9.24266791996483e+144

    1. Initial program 10.9

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

      \[\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-cbrt11.2

      \[\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(\sqrt[3]{z \cdot y - t \cdot a} \cdot \sqrt[3]{z \cdot y - t \cdot a}\right) \cdot \sqrt[3]{z \cdot y - t \cdot a}\right)} \cdot x\right)\right)\]

    if 9.24266791996483e+144 < z

    1. Initial program 23.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. Simplified23.3

      \[\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. Taylor expanded around inf 28.7

      \[\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. Simplified21.6

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

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

Reproduce

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