Average Error: 12.3 → 12.2
Time: 18.2s
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}\;x \le -1.852503661729898749176293013903203914112 \cdot 10^{-203}:\\ \;\;\;\;\mathsf{fma}\left(x, \mathsf{fma}\left(y, z, -a \cdot t\right), \mathsf{fma}\left(b, t \cdot i - c \cdot z, a \cdot \left(j \cdot c\right) + \left(-i \cdot \left(j \cdot y\right)\right)\right)\right)\\ \mathbf{elif}\;x \le 1.221908368878172879973730743257700463707 \cdot 10^{-259}:\\ \;\;\;\;\mathsf{fma}\left(x, 0, \mathsf{fma}\left(b, t \cdot i - c \cdot z, j \cdot \left(c \cdot a - y \cdot i\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x, \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}, \mathsf{fma}\left(b, 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}\;x \le -1.852503661729898749176293013903203914112 \cdot 10^{-203}:\\
\;\;\;\;\mathsf{fma}\left(x, \mathsf{fma}\left(y, z, -a \cdot t\right), \mathsf{fma}\left(b, t \cdot i - c \cdot z, a \cdot \left(j \cdot c\right) + \left(-i \cdot \left(j \cdot y\right)\right)\right)\right)\\

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, \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}, \mathsf{fma}\left(b, 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 r1080700 = x;
        double r1080701 = y;
        double r1080702 = z;
        double r1080703 = r1080701 * r1080702;
        double r1080704 = t;
        double r1080705 = a;
        double r1080706 = r1080704 * r1080705;
        double r1080707 = r1080703 - r1080706;
        double r1080708 = r1080700 * r1080707;
        double r1080709 = b;
        double r1080710 = c;
        double r1080711 = r1080710 * r1080702;
        double r1080712 = i;
        double r1080713 = r1080704 * r1080712;
        double r1080714 = r1080711 - r1080713;
        double r1080715 = r1080709 * r1080714;
        double r1080716 = r1080708 - r1080715;
        double r1080717 = j;
        double r1080718 = r1080710 * r1080705;
        double r1080719 = r1080701 * r1080712;
        double r1080720 = r1080718 - r1080719;
        double r1080721 = r1080717 * r1080720;
        double r1080722 = r1080716 + r1080721;
        return r1080722;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r1080723 = x;
        double r1080724 = -1.8525036617298987e-203;
        bool r1080725 = r1080723 <= r1080724;
        double r1080726 = y;
        double r1080727 = z;
        double r1080728 = a;
        double r1080729 = t;
        double r1080730 = r1080728 * r1080729;
        double r1080731 = -r1080730;
        double r1080732 = fma(r1080726, r1080727, r1080731);
        double r1080733 = b;
        double r1080734 = i;
        double r1080735 = r1080729 * r1080734;
        double r1080736 = c;
        double r1080737 = r1080736 * r1080727;
        double r1080738 = r1080735 - r1080737;
        double r1080739 = j;
        double r1080740 = r1080739 * r1080736;
        double r1080741 = r1080728 * r1080740;
        double r1080742 = r1080739 * r1080726;
        double r1080743 = r1080734 * r1080742;
        double r1080744 = -r1080743;
        double r1080745 = r1080741 + r1080744;
        double r1080746 = fma(r1080733, r1080738, r1080745);
        double r1080747 = fma(r1080723, r1080732, r1080746);
        double r1080748 = 1.2219083688781729e-259;
        bool r1080749 = r1080723 <= r1080748;
        double r1080750 = 0.0;
        double r1080751 = r1080736 * r1080728;
        double r1080752 = r1080726 * r1080734;
        double r1080753 = r1080751 - r1080752;
        double r1080754 = r1080739 * r1080753;
        double r1080755 = fma(r1080733, r1080738, r1080754);
        double r1080756 = fma(r1080723, r1080750, r1080755);
        double r1080757 = r1080726 * r1080727;
        double r1080758 = r1080729 * r1080728;
        double r1080759 = r1080757 - r1080758;
        double r1080760 = cbrt(r1080759);
        double r1080761 = r1080760 * r1080760;
        double r1080762 = r1080761 * r1080760;
        double r1080763 = fma(r1080723, r1080762, r1080755);
        double r1080764 = r1080749 ? r1080756 : r1080763;
        double r1080765 = r1080725 ? r1080747 : r1080764;
        return r1080765;
}

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
Target20.3
Herbie12.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 x < -1.8525036617298987e-203

    1. Initial program 10.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. Simplified10.8

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

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

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

      \[\leadsto \mathsf{fma}\left(x, \mathsf{fma}\left(y, z, -a \cdot t\right), \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)\]
    8. Applied associate-*l*11.1

      \[\leadsto \mathsf{fma}\left(x, \mathsf{fma}\left(y, z, -a \cdot t\right), \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)\]
    9. Using strategy rm
    10. Applied sub-neg11.1

      \[\leadsto \mathsf{fma}\left(x, \mathsf{fma}\left(y, z, -a \cdot t\right), \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)\]
    11. Applied distribute-lft-in11.1

      \[\leadsto \mathsf{fma}\left(x, \mathsf{fma}\left(y, z, -a \cdot t\right), \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)\]
    12. Applied distribute-lft-in11.1

      \[\leadsto \mathsf{fma}\left(x, \mathsf{fma}\left(y, z, -a \cdot t\right), \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)\]
    13. Simplified11.1

      \[\leadsto \mathsf{fma}\left(x, \mathsf{fma}\left(y, z, -a \cdot t\right), \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)\]
    14. Simplified11.0

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

    if -1.8525036617298987e-203 < x < 1.2219083688781729e-259

    1. Initial program 17.7

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

      \[\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. Taylor expanded around 0 15.9

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

    if 1.2219083688781729e-259 < x

    1. Initial program 11.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. Simplified11.6

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

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

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

Reproduce

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