Average Error: 12.4 → 13.7
Time: 25.9s
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}\;b \le -3.5447436542332151 \cdot 10^{-127}:\\ \;\;\;\;\mathsf{fma}\left(c \cdot t - i \cdot y, j, \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot \left(y \cdot z - t \cdot a\right)\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right)\\ \mathbf{elif}\;b \le -3.40149356120774805 \cdot 10^{-152}:\\ \;\;\;\;\mathsf{fma}\left(a, i \cdot b, -\mathsf{fma}\left(z, b \cdot c, a \cdot \left(x \cdot t\right)\right)\right)\\ \mathbf{elif}\;b \le 1.8227810540647952 \cdot 10^{-177}:\\ \;\;\;\;\mathsf{fma}\left(c \cdot t - i \cdot y, j, x \cdot \left(y \cdot z - t \cdot a\right) - 0\right)\\ \mathbf{elif}\;b \le 1.865590680694256 \cdot 10^{-152}:\\ \;\;\;\;\mathsf{fma}\left(a, i \cdot b, -\mathsf{fma}\left(z, b \cdot c, a \cdot \left(x \cdot t\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(c \cdot t - i \cdot y, j, x \cdot \left(y \cdot z - t \cdot a\right) - \sqrt{b} \cdot \left(\sqrt{b} \cdot \left(c \cdot z - i \cdot a\right)\right)\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}\;b \le -3.5447436542332151 \cdot 10^{-127}:\\
\;\;\;\;\mathsf{fma}\left(c \cdot t - i \cdot y, j, \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot \left(y \cdot z - t \cdot a\right)\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right)\\

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

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

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(c \cdot t - i \cdot y, j, x \cdot \left(y \cdot z - t \cdot a\right) - \sqrt{b} \cdot \left(\sqrt{b} \cdot \left(c \cdot z - i \cdot a\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 r2958 = x;
        double r2959 = y;
        double r2960 = z;
        double r2961 = r2959 * r2960;
        double r2962 = t;
        double r2963 = a;
        double r2964 = r2962 * r2963;
        double r2965 = r2961 - r2964;
        double r2966 = r2958 * r2965;
        double r2967 = b;
        double r2968 = c;
        double r2969 = r2968 * r2960;
        double r2970 = i;
        double r2971 = r2970 * r2963;
        double r2972 = r2969 - r2971;
        double r2973 = r2967 * r2972;
        double r2974 = r2966 - r2973;
        double r2975 = j;
        double r2976 = r2968 * r2962;
        double r2977 = r2970 * r2959;
        double r2978 = r2976 - r2977;
        double r2979 = r2975 * r2978;
        double r2980 = r2974 + r2979;
        return r2980;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r2981 = b;
        double r2982 = -3.544743654233215e-127;
        bool r2983 = r2981 <= r2982;
        double r2984 = c;
        double r2985 = t;
        double r2986 = r2984 * r2985;
        double r2987 = i;
        double r2988 = y;
        double r2989 = r2987 * r2988;
        double r2990 = r2986 - r2989;
        double r2991 = j;
        double r2992 = x;
        double r2993 = cbrt(r2992);
        double r2994 = r2993 * r2993;
        double r2995 = z;
        double r2996 = r2988 * r2995;
        double r2997 = a;
        double r2998 = r2985 * r2997;
        double r2999 = r2996 - r2998;
        double r3000 = r2993 * r2999;
        double r3001 = r2994 * r3000;
        double r3002 = r2984 * r2995;
        double r3003 = r2987 * r2997;
        double r3004 = r3002 - r3003;
        double r3005 = r2981 * r3004;
        double r3006 = r3001 - r3005;
        double r3007 = fma(r2990, r2991, r3006);
        double r3008 = -3.401493561207748e-152;
        bool r3009 = r2981 <= r3008;
        double r3010 = r2987 * r2981;
        double r3011 = r2981 * r2984;
        double r3012 = r2992 * r2985;
        double r3013 = r2997 * r3012;
        double r3014 = fma(r2995, r3011, r3013);
        double r3015 = -r3014;
        double r3016 = fma(r2997, r3010, r3015);
        double r3017 = 1.8227810540647952e-177;
        bool r3018 = r2981 <= r3017;
        double r3019 = r2992 * r2999;
        double r3020 = 0.0;
        double r3021 = r3019 - r3020;
        double r3022 = fma(r2990, r2991, r3021);
        double r3023 = 1.8655906806942557e-152;
        bool r3024 = r2981 <= r3023;
        double r3025 = sqrt(r2981);
        double r3026 = r3025 * r3004;
        double r3027 = r3025 * r3026;
        double r3028 = r3019 - r3027;
        double r3029 = fma(r2990, r2991, r3028);
        double r3030 = r3024 ? r3016 : r3029;
        double r3031 = r3018 ? r3022 : r3030;
        double r3032 = r3009 ? r3016 : r3031;
        double r3033 = r2983 ? r3007 : r3032;
        return r3033;
}

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.4
Target16.1
Herbie13.7
\[\begin{array}{l} \mathbf{if}\;t \lt -8.1209789191959122 \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.7125538182184851 \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.63353334603158369 \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.0535888557455487 \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 4 regimes
  2. if b < -3.544743654233215e-127

    1. Initial program 9.5

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

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

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

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

    if -3.544743654233215e-127 < b < -3.401493561207748e-152 or 1.8227810540647952e-177 < b < 1.8655906806942557e-152

    1. Initial program 16.4

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

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

      \[\leadsto \color{blue}{a \cdot \left(i \cdot b\right) - \left(z \cdot \left(b \cdot c\right) + a \cdot \left(x \cdot t\right)\right)}\]
    4. Simplified37.2

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

    if -3.401493561207748e-152 < b < 1.8227810540647952e-177

    1. Initial program 17.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. Simplified17.7

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

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

    if 1.8655906806942557e-152 < b

    1. Initial program 9.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. Simplified9.7

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -3.5447436542332151 \cdot 10^{-127}:\\ \;\;\;\;\mathsf{fma}\left(c \cdot t - i \cdot y, j, \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot \left(y \cdot z - t \cdot a\right)\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right)\\ \mathbf{elif}\;b \le -3.40149356120774805 \cdot 10^{-152}:\\ \;\;\;\;\mathsf{fma}\left(a, i \cdot b, -\mathsf{fma}\left(z, b \cdot c, a \cdot \left(x \cdot t\right)\right)\right)\\ \mathbf{elif}\;b \le 1.8227810540647952 \cdot 10^{-177}:\\ \;\;\;\;\mathsf{fma}\left(c \cdot t - i \cdot y, j, x \cdot \left(y \cdot z - t \cdot a\right) - 0\right)\\ \mathbf{elif}\;b \le 1.865590680694256 \cdot 10^{-152}:\\ \;\;\;\;\mathsf{fma}\left(a, i \cdot b, -\mathsf{fma}\left(z, b \cdot c, a \cdot \left(x \cdot t\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(c \cdot t - i \cdot y, j, x \cdot \left(y \cdot z - t \cdot a\right) - \sqrt{b} \cdot \left(\sqrt{b} \cdot \left(c \cdot z - i \cdot a\right)\right)\right)\\ \end{array}\]

Reproduce

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