Average Error: 12.3 → 10.6
Time: 32.8s
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.598051949792396904653419965913894074473 \cdot 10^{105}:\\ \;\;\;\;\left(z \cdot \left(x \cdot y - b \cdot c\right) - t \cdot \left(a \cdot x\right)\right) + \left(t \cdot c - y \cdot i\right) \cdot j\\ \mathbf{elif}\;z \le 1.201127816815718654143430033087724950747 \cdot 10^{-5}:\\ \;\;\;\;\mathsf{fma}\left(b, a \cdot i - c \cdot z, \sqrt[3]{x} \cdot \left(\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(y \cdot z - t \cdot a\right)\right)\right) + \left(t \cdot c - y \cdot i\right) \cdot j\\ \mathbf{else}:\\ \;\;\;\;\left(z \cdot \left(x \cdot y - b \cdot c\right) - t \cdot \left(a \cdot x\right)\right) + \left(t \cdot c - y \cdot i\right) \cdot j\\ \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.598051949792396904653419965913894074473 \cdot 10^{105}:\\
\;\;\;\;\left(z \cdot \left(x \cdot y - b \cdot c\right) - t \cdot \left(a \cdot x\right)\right) + \left(t \cdot c - y \cdot i\right) \cdot j\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r21916289 = x;
        double r21916290 = y;
        double r21916291 = z;
        double r21916292 = r21916290 * r21916291;
        double r21916293 = t;
        double r21916294 = a;
        double r21916295 = r21916293 * r21916294;
        double r21916296 = r21916292 - r21916295;
        double r21916297 = r21916289 * r21916296;
        double r21916298 = b;
        double r21916299 = c;
        double r21916300 = r21916299 * r21916291;
        double r21916301 = i;
        double r21916302 = r21916301 * r21916294;
        double r21916303 = r21916300 - r21916302;
        double r21916304 = r21916298 * r21916303;
        double r21916305 = r21916297 - r21916304;
        double r21916306 = j;
        double r21916307 = r21916299 * r21916293;
        double r21916308 = r21916301 * r21916290;
        double r21916309 = r21916307 - r21916308;
        double r21916310 = r21916306 * r21916309;
        double r21916311 = r21916305 + r21916310;
        return r21916311;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r21916312 = z;
        double r21916313 = -1.598051949792397e+105;
        bool r21916314 = r21916312 <= r21916313;
        double r21916315 = x;
        double r21916316 = y;
        double r21916317 = r21916315 * r21916316;
        double r21916318 = b;
        double r21916319 = c;
        double r21916320 = r21916318 * r21916319;
        double r21916321 = r21916317 - r21916320;
        double r21916322 = r21916312 * r21916321;
        double r21916323 = t;
        double r21916324 = a;
        double r21916325 = r21916324 * r21916315;
        double r21916326 = r21916323 * r21916325;
        double r21916327 = r21916322 - r21916326;
        double r21916328 = r21916323 * r21916319;
        double r21916329 = i;
        double r21916330 = r21916316 * r21916329;
        double r21916331 = r21916328 - r21916330;
        double r21916332 = j;
        double r21916333 = r21916331 * r21916332;
        double r21916334 = r21916327 + r21916333;
        double r21916335 = 1.2011278168157187e-05;
        bool r21916336 = r21916312 <= r21916335;
        double r21916337 = r21916324 * r21916329;
        double r21916338 = r21916319 * r21916312;
        double r21916339 = r21916337 - r21916338;
        double r21916340 = cbrt(r21916315);
        double r21916341 = r21916340 * r21916340;
        double r21916342 = r21916316 * r21916312;
        double r21916343 = r21916323 * r21916324;
        double r21916344 = r21916342 - r21916343;
        double r21916345 = r21916341 * r21916344;
        double r21916346 = r21916340 * r21916345;
        double r21916347 = fma(r21916318, r21916339, r21916346);
        double r21916348 = r21916347 + r21916333;
        double r21916349 = r21916336 ? r21916348 : r21916334;
        double r21916350 = r21916314 ? r21916334 : r21916349;
        return r21916350;
}

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.3
Herbie10.6
\[\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 < -1.598051949792397e+105 or 1.2011278168157187e-05 < z

    1. Initial program 18.8

      \[\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. Simplified18.8

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

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

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

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

    if -1.598051949792397e+105 < z < 1.2011278168157187e-05

    1. Initial program 9.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. Simplified9.5

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

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

      \[\leadsto \left(t \cdot c - i \cdot y\right) \cdot j + \mathsf{fma}\left(b, a \cdot i - z \cdot c, \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)\]
    7. Applied associate-*r*9.8

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

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

Reproduce

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