Average Error: 12.1 → 10.2
Time: 28.1s
Precision: 64
\[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\]
\[\begin{array}{l} \mathbf{if}\;j \le -3.260401236672284727679543684164179551587 \cdot 10^{62}:\\ \;\;\;\;\mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, \left(\sqrt[3]{t \cdot i - c \cdot z} \cdot \sqrt[3]{t \cdot i - c \cdot z}\right) \cdot \sqrt[3]{t \cdot i - c \cdot z}, j \cdot \left(c \cdot a - y \cdot i\right)\right)\right)\\ \mathbf{elif}\;j \le -4.257915606781290149622868595559270143504 \cdot 10^{-54}:\\ \;\;\;\;\mathsf{fma}\left(x, y \cdot z - t \cdot a, c \cdot \left(a \cdot j - z \cdot b\right) - i \cdot \left(y \cdot j\right)\right)\\ \mathbf{elif}\;j \le -1.369243025812474085049483349421987472158 \cdot 10^{-158}:\\ \;\;\;\;\mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, t \cdot i - c \cdot z, \left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \left(\sqrt[3]{a} \cdot \left(j \cdot c\right)\right) + \left(-i \cdot \left(y \cdot j\right)\right)\right)\right)\\ \mathbf{elif}\;j \le -5.432127131408618757501355515022627318912 \cdot 10^{-200}:\\ \;\;\;\;\mathsf{fma}\left(x, y \cdot z - t \cdot a, c \cdot \left(a \cdot j - z \cdot b\right) - i \cdot \left(y \cdot j\right)\right)\\ \mathbf{elif}\;j \le 186548833176480.1875:\\ \;\;\;\;\mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, t \cdot i - c \cdot z, \left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \left(\sqrt[3]{a} \cdot \left(j \cdot c\right)\right) + \left(-i \cdot \left(y \cdot j\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, \left(\sqrt[3]{t \cdot i - c \cdot z} \cdot \sqrt[3]{t \cdot i - c \cdot z}\right) \cdot \sqrt[3]{t \cdot i - c \cdot z}, j \cdot \left(c \cdot a - y \cdot i\right)\right)\right)\\ \end{array}\]
\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)
\begin{array}{l}
\mathbf{if}\;j \le -3.260401236672284727679543684164179551587 \cdot 10^{62}:\\
\;\;\;\;\mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, \left(\sqrt[3]{t \cdot i - c \cdot z} \cdot \sqrt[3]{t \cdot i - c \cdot z}\right) \cdot \sqrt[3]{t \cdot i - c \cdot z}, j \cdot \left(c \cdot a - y \cdot i\right)\right)\right)\\

\mathbf{elif}\;j \le -4.257915606781290149622868595559270143504 \cdot 10^{-54}:\\
\;\;\;\;\mathsf{fma}\left(x, y \cdot z - t \cdot a, c \cdot \left(a \cdot j - z \cdot b\right) - i \cdot \left(y \cdot j\right)\right)\\

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

\mathbf{elif}\;j \le -5.432127131408618757501355515022627318912 \cdot 10^{-200}:\\
\;\;\;\;\mathsf{fma}\left(x, y \cdot z - t \cdot a, c \cdot \left(a \cdot j - z \cdot b\right) - i \cdot \left(y \cdot j\right)\right)\\

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, \left(\sqrt[3]{t \cdot i - c \cdot z} \cdot \sqrt[3]{t \cdot i - c \cdot z}\right) \cdot \sqrt[3]{t \cdot i - c \cdot z}, j \cdot \left(c \cdot a - y \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 r401723 = x;
        double r401724 = y;
        double r401725 = z;
        double r401726 = r401724 * r401725;
        double r401727 = t;
        double r401728 = a;
        double r401729 = r401727 * r401728;
        double r401730 = r401726 - r401729;
        double r401731 = r401723 * r401730;
        double r401732 = b;
        double r401733 = c;
        double r401734 = r401733 * r401725;
        double r401735 = i;
        double r401736 = r401727 * r401735;
        double r401737 = r401734 - r401736;
        double r401738 = r401732 * r401737;
        double r401739 = r401731 - r401738;
        double r401740 = j;
        double r401741 = r401733 * r401728;
        double r401742 = r401724 * r401735;
        double r401743 = r401741 - r401742;
        double r401744 = r401740 * r401743;
        double r401745 = r401739 + r401744;
        return r401745;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r401746 = j;
        double r401747 = -3.2604012366722847e+62;
        bool r401748 = r401746 <= r401747;
        double r401749 = x;
        double r401750 = y;
        double r401751 = z;
        double r401752 = r401750 * r401751;
        double r401753 = t;
        double r401754 = a;
        double r401755 = r401753 * r401754;
        double r401756 = r401752 - r401755;
        double r401757 = b;
        double r401758 = i;
        double r401759 = r401753 * r401758;
        double r401760 = c;
        double r401761 = r401760 * r401751;
        double r401762 = r401759 - r401761;
        double r401763 = cbrt(r401762);
        double r401764 = r401763 * r401763;
        double r401765 = r401764 * r401763;
        double r401766 = r401760 * r401754;
        double r401767 = r401750 * r401758;
        double r401768 = r401766 - r401767;
        double r401769 = r401746 * r401768;
        double r401770 = fma(r401757, r401765, r401769);
        double r401771 = fma(r401749, r401756, r401770);
        double r401772 = -4.25791560678129e-54;
        bool r401773 = r401746 <= r401772;
        double r401774 = r401754 * r401746;
        double r401775 = r401751 * r401757;
        double r401776 = r401774 - r401775;
        double r401777 = r401760 * r401776;
        double r401778 = r401750 * r401746;
        double r401779 = r401758 * r401778;
        double r401780 = r401777 - r401779;
        double r401781 = fma(r401749, r401756, r401780);
        double r401782 = -1.369243025812474e-158;
        bool r401783 = r401746 <= r401782;
        double r401784 = cbrt(r401754);
        double r401785 = r401784 * r401784;
        double r401786 = r401746 * r401760;
        double r401787 = r401784 * r401786;
        double r401788 = r401785 * r401787;
        double r401789 = -r401779;
        double r401790 = r401788 + r401789;
        double r401791 = fma(r401757, r401762, r401790);
        double r401792 = fma(r401749, r401756, r401791);
        double r401793 = -5.432127131408619e-200;
        bool r401794 = r401746 <= r401793;
        double r401795 = 186548833176480.2;
        bool r401796 = r401746 <= r401795;
        double r401797 = r401796 ? r401792 : r401771;
        double r401798 = r401794 ? r401781 : r401797;
        double r401799 = r401783 ? r401792 : r401798;
        double r401800 = r401773 ? r401781 : r401799;
        double r401801 = r401748 ? r401771 : r401800;
        return r401801;
}

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.1
Target19.7
Herbie10.2
\[\begin{array}{l} \mathbf{if}\;x \lt -1.469694296777705016266218530347997287942 \cdot 10^{-64}:\\ \;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - \frac{b \cdot \left({\left(c \cdot z\right)}^{2} - {\left(t \cdot i\right)}^{2}\right)}{c \cdot z + t \cdot i}\right) + j \cdot \left(c \cdot a - y \cdot i\right)\\ \mathbf{elif}\;x \lt 3.21135273622268028942701600607048800714 \cdot 10^{-147}:\\ \;\;\;\;\left(b \cdot i - x \cdot a\right) \cdot t - \left(z \cdot \left(c \cdot b\right) - j \cdot \left(c \cdot a - y \cdot i\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - \frac{b \cdot \left({\left(c \cdot z\right)}^{2} - {\left(t \cdot i\right)}^{2}\right)}{c \cdot z + t \cdot i}\right) + j \cdot \left(c \cdot a - y \cdot i\right)\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if j < -3.2604012366722847e+62 or 186548833176480.2 < j

    1. Initial program 6.9

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\]
    2. Simplified6.9

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

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

    if -3.2604012366722847e+62 < j < -4.25791560678129e-54 or -1.369243025812474e-158 < j < -5.432127131408619e-200

    1. Initial program 12.1

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\]
    2. Simplified12.1

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

      \[\leadsto \mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, t \cdot i - c \cdot z, j \cdot \color{blue}{\left(\left(\sqrt[3]{c \cdot a - y \cdot i} \cdot \sqrt[3]{c \cdot a - y \cdot i}\right) \cdot \sqrt[3]{c \cdot a - y \cdot i}\right)}\right)\right)\]
    5. Applied associate-*r*12.4

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

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

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

    if -4.25791560678129e-54 < j < -1.369243025812474e-158 or -5.432127131408619e-200 < j < 186548833176480.2

    1. Initial program 15.2

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\]
    2. Simplified15.2

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

      \[\leadsto \mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, t \cdot i - c \cdot z, \color{blue}{\left(\left(\sqrt[3]{j} \cdot \sqrt[3]{j}\right) \cdot \sqrt[3]{j}\right)} \cdot \left(c \cdot a - y \cdot i\right)\right)\right)\]
    5. Applied associate-*l*15.3

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, t \cdot i - c \cdot z, \color{blue}{\left(\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \sqrt[3]{a}\right)} \cdot \left(j \cdot c\right) + \left(-i \cdot \left(y \cdot j\right)\right)\right)\right)\]
    14. Applied associate-*l*10.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;j \le -3.260401236672284727679543684164179551587 \cdot 10^{62}:\\ \;\;\;\;\mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, \left(\sqrt[3]{t \cdot i - c \cdot z} \cdot \sqrt[3]{t \cdot i - c \cdot z}\right) \cdot \sqrt[3]{t \cdot i - c \cdot z}, j \cdot \left(c \cdot a - y \cdot i\right)\right)\right)\\ \mathbf{elif}\;j \le -4.257915606781290149622868595559270143504 \cdot 10^{-54}:\\ \;\;\;\;\mathsf{fma}\left(x, y \cdot z - t \cdot a, c \cdot \left(a \cdot j - z \cdot b\right) - i \cdot \left(y \cdot j\right)\right)\\ \mathbf{elif}\;j \le -1.369243025812474085049483349421987472158 \cdot 10^{-158}:\\ \;\;\;\;\mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, t \cdot i - c \cdot z, \left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \left(\sqrt[3]{a} \cdot \left(j \cdot c\right)\right) + \left(-i \cdot \left(y \cdot j\right)\right)\right)\right)\\ \mathbf{elif}\;j \le -5.432127131408618757501355515022627318912 \cdot 10^{-200}:\\ \;\;\;\;\mathsf{fma}\left(x, y \cdot z - t \cdot a, c \cdot \left(a \cdot j - z \cdot b\right) - i \cdot \left(y \cdot j\right)\right)\\ \mathbf{elif}\;j \le 186548833176480.1875:\\ \;\;\;\;\mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, t \cdot i - c \cdot z, \left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \left(\sqrt[3]{a} \cdot \left(j \cdot c\right)\right) + \left(-i \cdot \left(y \cdot j\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, \left(\sqrt[3]{t \cdot i - c \cdot z} \cdot \sqrt[3]{t \cdot i - c \cdot z}\right) \cdot \sqrt[3]{t \cdot i - c \cdot z}, j \cdot \left(c \cdot a - y \cdot i\right)\right)\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019325 +o rules:numerics
(FPCore (x y z t a b c i j)
  :name "Data.Colour.Matrix:determinant from colour-2.3.3, A"
  :precision binary64

  :herbie-target
  (if (< x -1.469694296777705e-64) (+ (- (* x (- (* y z) (* t a))) (/ (* b (- (pow (* c z) 2) (pow (* t i) 2))) (+ (* c z) (* t i)))) (* j (- (* c a) (* y i)))) (if (< x 3.2113527362226803e-147) (- (* (- (* b i) (* x a)) t) (- (* z (* c b)) (* j (- (* c a) (* y i))))) (+ (- (* x (- (* y z) (* t a))) (/ (* b (- (pow (* c z) 2) (pow (* t i) 2))) (+ (* c z) (* t i)))) (* j (- (* c a) (* y i))))))

  (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* t i)))) (* j (- (* c a) (* y i)))))