Average Error: 12.0 → 11.6
Time: 32.0s
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 -1.692024971176755004489730368276965172524 \cdot 10^{-283}:\\ \;\;\;\;\left(\left(\mathsf{fma}\left(-a, t, a \cdot t\right) \cdot x - b \cdot \left(z \cdot c - a \cdot i\right)\right) + \mathsf{fma}\left(y, z, \left(-a\right) \cdot t\right) \cdot x\right) + \sqrt[3]{j \cdot \left(c \cdot t - y \cdot i\right)} \cdot \left(\left(\sqrt[3]{c \cdot t - y \cdot i} \cdot \sqrt[3]{j}\right) \cdot \sqrt[3]{j \cdot \left(c \cdot t - y \cdot i\right)}\right)\\ \mathbf{elif}\;x \le 2.083531344283219068569904816479604169105 \cdot 10^{-145}:\\ \;\;\;\;j \cdot \left(c \cdot t - y \cdot i\right) + \left(i \cdot \left(b \cdot a\right) - \mathsf{fma}\left(a, x \cdot t, b \cdot \left(z \cdot c\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;j \cdot \left(c \cdot t - y \cdot i\right) + \left(\left(\mathsf{fma}\left(-a, t, a \cdot t\right) \cdot x - b \cdot \left(z \cdot c - a \cdot i\right)\right) + \left(\left(y \cdot z - a \cdot t\right) \cdot \sqrt{x}\right) \cdot \sqrt{x}\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}\;x \le -1.692024971176755004489730368276965172524 \cdot 10^{-283}:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(-a, t, a \cdot t\right) \cdot x - b \cdot \left(z \cdot c - a \cdot i\right)\right) + \mathsf{fma}\left(y, z, \left(-a\right) \cdot t\right) \cdot x\right) + \sqrt[3]{j \cdot \left(c \cdot t - y \cdot i\right)} \cdot \left(\left(\sqrt[3]{c \cdot t - y \cdot i} \cdot \sqrt[3]{j}\right) \cdot \sqrt[3]{j \cdot \left(c \cdot t - y \cdot i\right)}\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r21054854 = x;
        double r21054855 = y;
        double r21054856 = z;
        double r21054857 = r21054855 * r21054856;
        double r21054858 = t;
        double r21054859 = a;
        double r21054860 = r21054858 * r21054859;
        double r21054861 = r21054857 - r21054860;
        double r21054862 = r21054854 * r21054861;
        double r21054863 = b;
        double r21054864 = c;
        double r21054865 = r21054864 * r21054856;
        double r21054866 = i;
        double r21054867 = r21054866 * r21054859;
        double r21054868 = r21054865 - r21054867;
        double r21054869 = r21054863 * r21054868;
        double r21054870 = r21054862 - r21054869;
        double r21054871 = j;
        double r21054872 = r21054864 * r21054858;
        double r21054873 = r21054866 * r21054855;
        double r21054874 = r21054872 - r21054873;
        double r21054875 = r21054871 * r21054874;
        double r21054876 = r21054870 + r21054875;
        return r21054876;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r21054877 = x;
        double r21054878 = -1.692024971176755e-283;
        bool r21054879 = r21054877 <= r21054878;
        double r21054880 = a;
        double r21054881 = -r21054880;
        double r21054882 = t;
        double r21054883 = r21054880 * r21054882;
        double r21054884 = fma(r21054881, r21054882, r21054883);
        double r21054885 = r21054884 * r21054877;
        double r21054886 = b;
        double r21054887 = z;
        double r21054888 = c;
        double r21054889 = r21054887 * r21054888;
        double r21054890 = i;
        double r21054891 = r21054880 * r21054890;
        double r21054892 = r21054889 - r21054891;
        double r21054893 = r21054886 * r21054892;
        double r21054894 = r21054885 - r21054893;
        double r21054895 = y;
        double r21054896 = r21054881 * r21054882;
        double r21054897 = fma(r21054895, r21054887, r21054896);
        double r21054898 = r21054897 * r21054877;
        double r21054899 = r21054894 + r21054898;
        double r21054900 = j;
        double r21054901 = r21054888 * r21054882;
        double r21054902 = r21054895 * r21054890;
        double r21054903 = r21054901 - r21054902;
        double r21054904 = r21054900 * r21054903;
        double r21054905 = cbrt(r21054904);
        double r21054906 = cbrt(r21054903);
        double r21054907 = cbrt(r21054900);
        double r21054908 = r21054906 * r21054907;
        double r21054909 = r21054908 * r21054905;
        double r21054910 = r21054905 * r21054909;
        double r21054911 = r21054899 + r21054910;
        double r21054912 = 2.083531344283219e-145;
        bool r21054913 = r21054877 <= r21054912;
        double r21054914 = r21054886 * r21054880;
        double r21054915 = r21054890 * r21054914;
        double r21054916 = r21054877 * r21054882;
        double r21054917 = r21054886 * r21054889;
        double r21054918 = fma(r21054880, r21054916, r21054917);
        double r21054919 = r21054915 - r21054918;
        double r21054920 = r21054904 + r21054919;
        double r21054921 = r21054895 * r21054887;
        double r21054922 = r21054921 - r21054883;
        double r21054923 = sqrt(r21054877);
        double r21054924 = r21054922 * r21054923;
        double r21054925 = r21054924 * r21054923;
        double r21054926 = r21054894 + r21054925;
        double r21054927 = r21054904 + r21054926;
        double r21054928 = r21054913 ? r21054920 : r21054927;
        double r21054929 = r21054879 ? r21054911 : r21054928;
        return r21054929;
}

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.0
Target15.7
Herbie11.6
\[\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 3 regimes
  2. if x < -1.692024971176755e-283

    1. Initial program 11.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. Using strategy rm
    3. Applied prod-diff11.7

      \[\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)} - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)\]
    4. Applied distribute-lft-in11.7

      \[\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)} - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)\]
    5. Applied associate--l+11.7

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

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

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

    if -1.692024971176755e-283 < x < 2.083531344283219e-145

    1. Initial program 16.3

      \[\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. Taylor expanded around inf 11.9

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

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

    if 2.083531344283219e-145 < x

    1. Initial program 9.9

      \[\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 prod-diff9.9

      \[\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)} - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)\]
    4. Applied distribute-lft-in9.9

      \[\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)} - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)\]
    5. Applied associate--l+9.9

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -1.692024971176755004489730368276965172524 \cdot 10^{-283}:\\ \;\;\;\;\left(\left(\mathsf{fma}\left(-a, t, a \cdot t\right) \cdot x - b \cdot \left(z \cdot c - a \cdot i\right)\right) + \mathsf{fma}\left(y, z, \left(-a\right) \cdot t\right) \cdot x\right) + \sqrt[3]{j \cdot \left(c \cdot t - y \cdot i\right)} \cdot \left(\left(\sqrt[3]{c \cdot t - y \cdot i} \cdot \sqrt[3]{j}\right) \cdot \sqrt[3]{j \cdot \left(c \cdot t - y \cdot i\right)}\right)\\ \mathbf{elif}\;x \le 2.083531344283219068569904816479604169105 \cdot 10^{-145}:\\ \;\;\;\;j \cdot \left(c \cdot t - y \cdot i\right) + \left(i \cdot \left(b \cdot a\right) - \mathsf{fma}\left(a, x \cdot t, b \cdot \left(z \cdot c\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;j \cdot \left(c \cdot t - y \cdot i\right) + \left(\left(\mathsf{fma}\left(-a, t, a \cdot t\right) \cdot x - b \cdot \left(z \cdot c - a \cdot i\right)\right) + \left(\left(y \cdot z - a \cdot t\right) \cdot \sqrt{x}\right) \cdot \sqrt{x}\right)\\ \end{array}\]

Reproduce

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

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