Average Error: 12.3 → 10.9
Time: 9.4s
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}\;x \le -24461250474772234537684702372140140199940 \lor \neg \left(x \le 1.790964636289325521384799430352513564635 \cdot 10^{61}\right):\\ \;\;\;\;\left(\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) + {\left(j \cdot \mathsf{fma}\left(c, t, -y \cdot i\right)\right)}^{1}\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\left(x \cdot y\right) \cdot z + x \cdot \left(-t \cdot a\right)\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + {\left(j \cdot \mathsf{fma}\left(c, t, -y \cdot i\right)\right)}^{1}\\ \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}\;x \le -24461250474772234537684702372140140199940 \lor \neg \left(x \le 1.790964636289325521384799430352513564635 \cdot 10^{61}\right):\\
\;\;\;\;\left(\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) + {\left(j \cdot \mathsf{fma}\left(c, t, -y \cdot i\right)\right)}^{1}\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r549625 = x;
        double r549626 = y;
        double r549627 = z;
        double r549628 = r549626 * r549627;
        double r549629 = t;
        double r549630 = a;
        double r549631 = r549629 * r549630;
        double r549632 = r549628 - r549631;
        double r549633 = r549625 * r549632;
        double r549634 = b;
        double r549635 = c;
        double r549636 = r549635 * r549627;
        double r549637 = i;
        double r549638 = r549637 * r549630;
        double r549639 = r549636 - r549638;
        double r549640 = r549634 * r549639;
        double r549641 = r549633 - r549640;
        double r549642 = j;
        double r549643 = r549635 * r549629;
        double r549644 = r549637 * r549626;
        double r549645 = r549643 - r549644;
        double r549646 = r549642 * r549645;
        double r549647 = r549641 + r549646;
        return r549647;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r549648 = x;
        double r549649 = -2.4461250474772235e+40;
        bool r549650 = r549648 <= r549649;
        double r549651 = 1.7909646362893255e+61;
        bool r549652 = r549648 <= r549651;
        double r549653 = !r549652;
        bool r549654 = r549650 || r549653;
        double r549655 = y;
        double r549656 = z;
        double r549657 = a;
        double r549658 = t;
        double r549659 = r549657 * r549658;
        double r549660 = -r549659;
        double r549661 = fma(r549655, r549656, r549660);
        double r549662 = r549648 * r549661;
        double r549663 = -r549657;
        double r549664 = fma(r549663, r549658, r549659);
        double r549665 = r549648 * r549664;
        double r549666 = r549662 + r549665;
        double r549667 = b;
        double r549668 = c;
        double r549669 = r549656 * r549668;
        double r549670 = i;
        double r549671 = r549657 * r549670;
        double r549672 = r549669 - r549671;
        double r549673 = r549667 * r549672;
        double r549674 = fma(r549663, r549670, r549671);
        double r549675 = r549667 * r549674;
        double r549676 = r549673 + r549675;
        double r549677 = r549666 - r549676;
        double r549678 = j;
        double r549679 = r549655 * r549670;
        double r549680 = -r549679;
        double r549681 = fma(r549668, r549658, r549680);
        double r549682 = r549678 * r549681;
        double r549683 = 1.0;
        double r549684 = pow(r549682, r549683);
        double r549685 = r549677 + r549684;
        double r549686 = r549648 * r549655;
        double r549687 = r549686 * r549656;
        double r549688 = r549658 * r549657;
        double r549689 = -r549688;
        double r549690 = r549648 * r549689;
        double r549691 = r549687 + r549690;
        double r549692 = r549668 * r549656;
        double r549693 = r549670 * r549657;
        double r549694 = r549692 - r549693;
        double r549695 = r549667 * r549694;
        double r549696 = r549691 - r549695;
        double r549697 = r549696 + r549684;
        double r549698 = r549654 ? r549685 : r549697;
        return r549698;
}

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.2
Herbie10.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 x < -2.4461250474772235e+40 or 1.7909646362893255e+61 < x

    1. Initial program 7.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. Using strategy rm
    3. Applied pow17.8

      \[\leadsto \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \color{blue}{{\left(c \cdot t - i \cdot y\right)}^{1}}\]
    4. Applied pow17.8

      \[\leadsto \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + \color{blue}{{j}^{1}} \cdot {\left(c \cdot t - i \cdot y\right)}^{1}\]
    5. Applied pow-prod-down7.8

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

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

      \[\leadsto \left(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) + {\left(j \cdot \mathsf{fma}\left(c, t, -y \cdot i\right)\right)}^{1}\]
    9. Applied distribute-lft-in7.8

      \[\leadsto \left(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) + {\left(j \cdot \mathsf{fma}\left(c, t, -y \cdot i\right)\right)}^{1}\]
    10. Simplified7.8

      \[\leadsto \left(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) + {\left(j \cdot \mathsf{fma}\left(c, t, -y \cdot i\right)\right)}^{1}\]
    11. Using strategy rm
    12. Applied prod-diff7.8

      \[\leadsto \left(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) + {\left(j \cdot \mathsf{fma}\left(c, t, -y \cdot i\right)\right)}^{1}\]
    13. Applied distribute-lft-in7.8

      \[\leadsto \left(\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) + {\left(j \cdot \mathsf{fma}\left(c, t, -y \cdot i\right)\right)}^{1}\]

    if -2.4461250474772235e+40 < x < 1.7909646362893255e+61

    1. Initial program 14.2

      \[\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. Using strategy rm
    3. Applied pow114.2

      \[\leadsto \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \color{blue}{{\left(c \cdot t - i \cdot y\right)}^{1}}\]
    4. Applied pow114.2

      \[\leadsto \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + \color{blue}{{j}^{1}} \cdot {\left(c \cdot t - i \cdot y\right)}^{1}\]
    5. Applied pow-prod-down14.2

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

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

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

      \[\leadsto \left(\color{blue}{\left(x \cdot \left(y \cdot z\right) + x \cdot \left(-t \cdot a\right)\right)} - b \cdot \left(c \cdot z - i \cdot a\right)\right) + {\left(j \cdot \mathsf{fma}\left(c, t, -y \cdot i\right)\right)}^{1}\]
    10. Using strategy rm
    11. Applied associate-*r*12.3

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -24461250474772234537684702372140140199940 \lor \neg \left(x \le 1.790964636289325521384799430352513564635 \cdot 10^{61}\right):\\ \;\;\;\;\left(\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) + {\left(j \cdot \mathsf{fma}\left(c, t, -y \cdot i\right)\right)}^{1}\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\left(x \cdot y\right) \cdot z + x \cdot \left(-t \cdot a\right)\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + {\left(j \cdot \mathsf{fma}\left(c, t, -y \cdot i\right)\right)}^{1}\\ \end{array}\]

Reproduce

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