Average Error: 12.4 → 14.1
Time: 11.5s
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.6318733222302293 \cdot 10^{152} \lor \neg \left(z \le 3.5058906695120028 \cdot 10^{174}\right):\\ \;\;\;\;\mathsf{fma}\left(a, i \cdot b, -\mathsf{fma}\left(z, b \cdot c, a \cdot \left(x \cdot t\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(c \cdot t - i \cdot y, j, \left(x \cdot \mathsf{fma}\left(y, z, -a \cdot t\right) + x \cdot \mathsf{fma}\left(-a, t, a \cdot t\right)\right) - \left(b \cdot \left(z \cdot c - a \cdot i\right) + b \cdot \mathsf{fma}\left(-a, i, a \cdot i\right)\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.6318733222302293 \cdot 10^{152} \lor \neg \left(z \le 3.5058906695120028 \cdot 10^{174}\right):\\
\;\;\;\;\mathsf{fma}\left(a, i \cdot b, -\mathsf{fma}\left(z, b \cdot c, a \cdot \left(x \cdot t\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(c \cdot t - i \cdot y, j, \left(x \cdot \mathsf{fma}\left(y, z, -a \cdot t\right) + x \cdot \mathsf{fma}\left(-a, t, a \cdot t\right)\right) - \left(b \cdot \left(z \cdot c - a \cdot i\right) + b \cdot \mathsf{fma}\left(-a, i, a \cdot i\right)\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 r617614 = x;
        double r617615 = y;
        double r617616 = z;
        double r617617 = r617615 * r617616;
        double r617618 = t;
        double r617619 = a;
        double r617620 = r617618 * r617619;
        double r617621 = r617617 - r617620;
        double r617622 = r617614 * r617621;
        double r617623 = b;
        double r617624 = c;
        double r617625 = r617624 * r617616;
        double r617626 = i;
        double r617627 = r617626 * r617619;
        double r617628 = r617625 - r617627;
        double r617629 = r617623 * r617628;
        double r617630 = r617622 - r617629;
        double r617631 = j;
        double r617632 = r617624 * r617618;
        double r617633 = r617626 * r617615;
        double r617634 = r617632 - r617633;
        double r617635 = r617631 * r617634;
        double r617636 = r617630 + r617635;
        return r617636;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r617637 = z;
        double r617638 = -2.6318733222302293e+152;
        bool r617639 = r617637 <= r617638;
        double r617640 = 3.505890669512003e+174;
        bool r617641 = r617637 <= r617640;
        double r617642 = !r617641;
        bool r617643 = r617639 || r617642;
        double r617644 = a;
        double r617645 = i;
        double r617646 = b;
        double r617647 = r617645 * r617646;
        double r617648 = c;
        double r617649 = r617646 * r617648;
        double r617650 = x;
        double r617651 = t;
        double r617652 = r617650 * r617651;
        double r617653 = r617644 * r617652;
        double r617654 = fma(r617637, r617649, r617653);
        double r617655 = -r617654;
        double r617656 = fma(r617644, r617647, r617655);
        double r617657 = r617648 * r617651;
        double r617658 = y;
        double r617659 = r617645 * r617658;
        double r617660 = r617657 - r617659;
        double r617661 = j;
        double r617662 = r617644 * r617651;
        double r617663 = -r617662;
        double r617664 = fma(r617658, r617637, r617663);
        double r617665 = r617650 * r617664;
        double r617666 = -r617644;
        double r617667 = fma(r617666, r617651, r617662);
        double r617668 = r617650 * r617667;
        double r617669 = r617665 + r617668;
        double r617670 = r617637 * r617648;
        double r617671 = r617644 * r617645;
        double r617672 = r617670 - r617671;
        double r617673 = r617646 * r617672;
        double r617674 = fma(r617666, r617645, r617671);
        double r617675 = r617646 * r617674;
        double r617676 = r617673 + r617675;
        double r617677 = r617669 - r617676;
        double r617678 = fma(r617660, r617661, r617677);
        double r617679 = r617643 ? r617656 : r617678;
        return r617679;
}

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.4
Target16.1
Herbie14.1
\[\begin{array}{l} \mathbf{if}\;t \lt -8.1209789191959122 \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.7125538182184851 \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.63353334603158369 \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} - {\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.6318733222302293e+152 or 3.505890669512003e+174 < z

    1. Initial program 23.0

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

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

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

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

    if -2.6318733222302293e+152 < z < 3.505890669512003e+174

    1. Initial program 10.7

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -2.6318733222302293 \cdot 10^{152} \lor \neg \left(z \le 3.5058906695120028 \cdot 10^{174}\right):\\ \;\;\;\;\mathsf{fma}\left(a, i \cdot b, -\mathsf{fma}\left(z, b \cdot c, a \cdot \left(x \cdot t\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(c \cdot t - i \cdot y, j, \left(x \cdot \mathsf{fma}\left(y, z, -a \cdot t\right) + x \cdot \mathsf{fma}\left(-a, t, a \cdot t\right)\right) - \left(b \cdot \left(z \cdot c - a \cdot i\right) + b \cdot \mathsf{fma}\left(-a, i, a \cdot i\right)\right)\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020060 +o rules:numerics
(FPCore (x y z t a b c i j)
  :name "Linear.Matrix:det33 from linear-1.19.1.3"
  :precision binary64

  :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) (pow (* i y) 2))) (+ (* 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) (pow (* i y) 2))) (+ (* 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)))))