Average Error: 11.8 → 9.9
Time: 1.2m
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 -5.827232257640775845668916842368578499537 \cdot 10^{78}:\\ \;\;\;\;\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 2.655468675482446383692527222545484495067 \cdot 10^{98}:\\ \;\;\;\;\mathsf{fma}\left(a \cdot i - c \cdot z, b, \left(y \cdot z - t \cdot a\right) \cdot x\right) + \left(\sqrt[3]{t \cdot c - y \cdot i} \cdot j\right) \cdot \left(\sqrt[3]{t \cdot c - y \cdot i} \cdot \sqrt[3]{t \cdot c - y \cdot i}\right)\\ \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 -5.827232257640775845668916842368578499537 \cdot 10^{78}:\\
\;\;\;\;\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 2.655468675482446383692527222545484495067 \cdot 10^{98}:\\
\;\;\;\;\mathsf{fma}\left(a \cdot i - c \cdot z, b, \left(y \cdot z - t \cdot a\right) \cdot x\right) + \left(\sqrt[3]{t \cdot c - y \cdot i} \cdot j\right) \cdot \left(\sqrt[3]{t \cdot c - y \cdot i} \cdot \sqrt[3]{t \cdot c - y \cdot i}\right)\\

\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 r28673650 = x;
        double r28673651 = y;
        double r28673652 = z;
        double r28673653 = r28673651 * r28673652;
        double r28673654 = t;
        double r28673655 = a;
        double r28673656 = r28673654 * r28673655;
        double r28673657 = r28673653 - r28673656;
        double r28673658 = r28673650 * r28673657;
        double r28673659 = b;
        double r28673660 = c;
        double r28673661 = r28673660 * r28673652;
        double r28673662 = i;
        double r28673663 = r28673662 * r28673655;
        double r28673664 = r28673661 - r28673663;
        double r28673665 = r28673659 * r28673664;
        double r28673666 = r28673658 - r28673665;
        double r28673667 = j;
        double r28673668 = r28673660 * r28673654;
        double r28673669 = r28673662 * r28673651;
        double r28673670 = r28673668 - r28673669;
        double r28673671 = r28673667 * r28673670;
        double r28673672 = r28673666 + r28673671;
        return r28673672;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r28673673 = z;
        double r28673674 = -5.827232257640776e+78;
        bool r28673675 = r28673673 <= r28673674;
        double r28673676 = x;
        double r28673677 = y;
        double r28673678 = r28673676 * r28673677;
        double r28673679 = b;
        double r28673680 = c;
        double r28673681 = r28673679 * r28673680;
        double r28673682 = r28673678 - r28673681;
        double r28673683 = r28673673 * r28673682;
        double r28673684 = t;
        double r28673685 = a;
        double r28673686 = r28673685 * r28673676;
        double r28673687 = r28673684 * r28673686;
        double r28673688 = r28673683 - r28673687;
        double r28673689 = r28673684 * r28673680;
        double r28673690 = i;
        double r28673691 = r28673677 * r28673690;
        double r28673692 = r28673689 - r28673691;
        double r28673693 = j;
        double r28673694 = r28673692 * r28673693;
        double r28673695 = r28673688 + r28673694;
        double r28673696 = 2.6554686754824464e+98;
        bool r28673697 = r28673673 <= r28673696;
        double r28673698 = r28673685 * r28673690;
        double r28673699 = r28673680 * r28673673;
        double r28673700 = r28673698 - r28673699;
        double r28673701 = r28673677 * r28673673;
        double r28673702 = r28673684 * r28673685;
        double r28673703 = r28673701 - r28673702;
        double r28673704 = r28673703 * r28673676;
        double r28673705 = fma(r28673700, r28673679, r28673704);
        double r28673706 = cbrt(r28673692);
        double r28673707 = r28673706 * r28673693;
        double r28673708 = r28673706 * r28673706;
        double r28673709 = r28673707 * r28673708;
        double r28673710 = r28673705 + r28673709;
        double r28673711 = r28673697 ? r28673710 : r28673695;
        double r28673712 = r28673675 ? r28673695 : r28673711;
        return r28673712;
}

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

Original11.8
Target15.9
Herbie9.9
\[\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 < -5.827232257640776e+78 or 2.6554686754824464e+98 < 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(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 fma-udef20.3

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

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

      \[\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(a \cdot x\right)\right)}\]

    if -5.827232257640776e+78 < z < 2.6554686754824464e+98

    1. Initial program 8.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. Simplified8.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 fma-udef8.9

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -5.827232257640775845668916842368578499537 \cdot 10^{78}:\\ \;\;\;\;\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 2.655468675482446383692527222545484495067 \cdot 10^{98}:\\ \;\;\;\;\mathsf{fma}\left(a \cdot i - c \cdot z, b, \left(y \cdot z - t \cdot a\right) \cdot x\right) + \left(\sqrt[3]{t \cdot c - y \cdot i} \cdot j\right) \cdot \left(\sqrt[3]{t \cdot c - y \cdot i} \cdot \sqrt[3]{t \cdot c - y \cdot i}\right)\\ \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 2019168 +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)))))