Average Error: 11.5 → 11.4
Time: 13.3s
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}\;b \le -2.3986690809889342 \cdot 10^{-188}:\\ \;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, j, x \cdot \left(\left(\left(\sqrt[3]{\sqrt[3]{y \cdot z - t \cdot a} \cdot \sqrt[3]{y \cdot z - t \cdot a}} \cdot \sqrt[3]{\sqrt[3]{y \cdot z - t \cdot a}}\right) \cdot \sqrt[3]{y \cdot z - t \cdot a}\right) \cdot \sqrt[3]{y \cdot z - t \cdot a}\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right)\\ \mathbf{elif}\;b \le 1.7589150951427087 \cdot 10^{-208}:\\ \;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, j, x \cdot \left(y \cdot z - t \cdot a\right) - 0\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, 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(\sqrt{b} \cdot \left(\sqrt{b} \cdot \left(c \cdot z - t \cdot i\right)\right) + b \cdot \mathsf{fma}\left(-i, t, i \cdot t\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}\;b \le -2.3986690809889342 \cdot 10^{-188}:\\
\;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, j, x \cdot \left(\left(\left(\sqrt[3]{\sqrt[3]{y \cdot z - t \cdot a} \cdot \sqrt[3]{y \cdot z - t \cdot a}} \cdot \sqrt[3]{\sqrt[3]{y \cdot z - t \cdot a}}\right) \cdot \sqrt[3]{y \cdot z - t \cdot a}\right) \cdot \sqrt[3]{y \cdot z - t \cdot a}\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right)\\

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, 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(\sqrt{b} \cdot \left(\sqrt{b} \cdot \left(c \cdot z - t \cdot i\right)\right) + b \cdot \mathsf{fma}\left(-i, t, i \cdot t\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 r912716 = x;
        double r912717 = y;
        double r912718 = z;
        double r912719 = r912717 * r912718;
        double r912720 = t;
        double r912721 = a;
        double r912722 = r912720 * r912721;
        double r912723 = r912719 - r912722;
        double r912724 = r912716 * r912723;
        double r912725 = b;
        double r912726 = c;
        double r912727 = r912726 * r912718;
        double r912728 = i;
        double r912729 = r912720 * r912728;
        double r912730 = r912727 - r912729;
        double r912731 = r912725 * r912730;
        double r912732 = r912724 - r912731;
        double r912733 = j;
        double r912734 = r912726 * r912721;
        double r912735 = r912717 * r912728;
        double r912736 = r912734 - r912735;
        double r912737 = r912733 * r912736;
        double r912738 = r912732 + r912737;
        return r912738;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r912739 = b;
        double r912740 = -2.3986690809889342e-188;
        bool r912741 = r912739 <= r912740;
        double r912742 = c;
        double r912743 = a;
        double r912744 = r912742 * r912743;
        double r912745 = y;
        double r912746 = i;
        double r912747 = r912745 * r912746;
        double r912748 = r912744 - r912747;
        double r912749 = j;
        double r912750 = x;
        double r912751 = z;
        double r912752 = r912745 * r912751;
        double r912753 = t;
        double r912754 = r912753 * r912743;
        double r912755 = r912752 - r912754;
        double r912756 = cbrt(r912755);
        double r912757 = r912756 * r912756;
        double r912758 = cbrt(r912757);
        double r912759 = cbrt(r912756);
        double r912760 = r912758 * r912759;
        double r912761 = r912760 * r912756;
        double r912762 = r912761 * r912756;
        double r912763 = r912750 * r912762;
        double r912764 = r912742 * r912751;
        double r912765 = r912753 * r912746;
        double r912766 = r912764 - r912765;
        double r912767 = r912739 * r912766;
        double r912768 = r912763 - r912767;
        double r912769 = fma(r912748, r912749, r912768);
        double r912770 = 1.7589150951427087e-208;
        bool r912771 = r912739 <= r912770;
        double r912772 = r912750 * r912755;
        double r912773 = 0.0;
        double r912774 = r912772 - r912773;
        double r912775 = fma(r912748, r912749, r912774);
        double r912776 = r912743 * r912753;
        double r912777 = -r912776;
        double r912778 = fma(r912745, r912751, r912777);
        double r912779 = r912750 * r912778;
        double r912780 = -r912743;
        double r912781 = fma(r912780, r912753, r912776);
        double r912782 = r912750 * r912781;
        double r912783 = r912779 + r912782;
        double r912784 = sqrt(r912739);
        double r912785 = r912784 * r912766;
        double r912786 = r912784 * r912785;
        double r912787 = -r912746;
        double r912788 = r912746 * r912753;
        double r912789 = fma(r912787, r912753, r912788);
        double r912790 = r912739 * r912789;
        double r912791 = r912786 + r912790;
        double r912792 = r912783 - r912791;
        double r912793 = fma(r912748, r912749, r912792);
        double r912794 = r912771 ? r912775 : r912793;
        double r912795 = r912741 ? r912769 : r912794;
        return r912795;
}

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.5
Target19.4
Herbie11.4
\[\begin{array}{l} \mathbf{if}\;x \lt -1.46969429677770502 \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.2113527362226803 \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 b < -2.3986690809889342e-188

    1. Initial program 9.6

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

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

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

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

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

    if -2.3986690809889342e-188 < b < 1.7589150951427087e-208

    1. Initial program 16.8

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

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

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

    if 1.7589150951427087e-208 < b

    1. Initial program 10.4

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(c \cdot a - y \cdot i, 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(c \cdot z - t \cdot i\right) + b \cdot \mathsf{fma}\left(-i, t, i \cdot t\right)\right)\right)\]
    9. Applied distribute-lft-in10.3

      \[\leadsto \mathsf{fma}\left(c \cdot a - y \cdot i, 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(c \cdot z - t \cdot i\right) + b \cdot \mathsf{fma}\left(-i, t, i \cdot t\right)\right)\right)\]
    10. Using strategy rm
    11. Applied add-sqr-sqrt10.5

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -2.3986690809889342 \cdot 10^{-188}:\\ \;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, j, x \cdot \left(\left(\left(\sqrt[3]{\sqrt[3]{y \cdot z - t \cdot a} \cdot \sqrt[3]{y \cdot z - t \cdot a}} \cdot \sqrt[3]{\sqrt[3]{y \cdot z - t \cdot a}}\right) \cdot \sqrt[3]{y \cdot z - t \cdot a}\right) \cdot \sqrt[3]{y \cdot z - t \cdot a}\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right)\\ \mathbf{elif}\;b \le 1.7589150951427087 \cdot 10^{-208}:\\ \;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, j, x \cdot \left(y \cdot z - t \cdot a\right) - 0\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, 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(\sqrt{b} \cdot \left(\sqrt{b} \cdot \left(c \cdot z - t \cdot i\right)\right) + b \cdot \mathsf{fma}\left(-i, t, i \cdot t\right)\right)\right)\\ \end{array}\]

Reproduce

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