Average Error: 11.9 → 10.4
Time: 31.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}\;b \le -4.5537297373874334 \cdot 10^{-181}:\\ \;\;\;\;\mathsf{fma}\left(t \cdot c - y \cdot i, j, \mathsf{fma}\left(a \cdot i - c \cdot z, b, \left(y \cdot z - t \cdot a\right) \cdot x\right)\right)\\ \mathbf{elif}\;b \le 2.6161480995206308 \cdot 10^{-142}:\\ \;\;\;\;\mathsf{fma}\left(t \cdot c - y \cdot i, j, \left(x \cdot y - c \cdot b\right) \cdot z - \left(t \cdot x\right) \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t \cdot c - y \cdot i, j, \mathsf{fma}\left(a \cdot i - c \cdot z, b, \left(y \cdot z - t \cdot a\right) \cdot x\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 -4.5537297373874334 \cdot 10^{-181}:\\
\;\;\;\;\mathsf{fma}\left(t \cdot c - y \cdot i, j, \mathsf{fma}\left(a \cdot i - c \cdot z, b, \left(y \cdot z - t \cdot a\right) \cdot x\right)\right)\\

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t \cdot c - y \cdot i, j, \mathsf{fma}\left(a \cdot i - c \cdot z, b, \left(y \cdot z - t \cdot a\right) \cdot x\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 r24133881 = x;
        double r24133882 = y;
        double r24133883 = z;
        double r24133884 = r24133882 * r24133883;
        double r24133885 = t;
        double r24133886 = a;
        double r24133887 = r24133885 * r24133886;
        double r24133888 = r24133884 - r24133887;
        double r24133889 = r24133881 * r24133888;
        double r24133890 = b;
        double r24133891 = c;
        double r24133892 = r24133891 * r24133883;
        double r24133893 = i;
        double r24133894 = r24133893 * r24133886;
        double r24133895 = r24133892 - r24133894;
        double r24133896 = r24133890 * r24133895;
        double r24133897 = r24133889 - r24133896;
        double r24133898 = j;
        double r24133899 = r24133891 * r24133885;
        double r24133900 = r24133893 * r24133882;
        double r24133901 = r24133899 - r24133900;
        double r24133902 = r24133898 * r24133901;
        double r24133903 = r24133897 + r24133902;
        return r24133903;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r24133904 = b;
        double r24133905 = -4.5537297373874334e-181;
        bool r24133906 = r24133904 <= r24133905;
        double r24133907 = t;
        double r24133908 = c;
        double r24133909 = r24133907 * r24133908;
        double r24133910 = y;
        double r24133911 = i;
        double r24133912 = r24133910 * r24133911;
        double r24133913 = r24133909 - r24133912;
        double r24133914 = j;
        double r24133915 = a;
        double r24133916 = r24133915 * r24133911;
        double r24133917 = z;
        double r24133918 = r24133908 * r24133917;
        double r24133919 = r24133916 - r24133918;
        double r24133920 = r24133910 * r24133917;
        double r24133921 = r24133907 * r24133915;
        double r24133922 = r24133920 - r24133921;
        double r24133923 = x;
        double r24133924 = r24133922 * r24133923;
        double r24133925 = fma(r24133919, r24133904, r24133924);
        double r24133926 = fma(r24133913, r24133914, r24133925);
        double r24133927 = 2.6161480995206308e-142;
        bool r24133928 = r24133904 <= r24133927;
        double r24133929 = r24133923 * r24133910;
        double r24133930 = r24133908 * r24133904;
        double r24133931 = r24133929 - r24133930;
        double r24133932 = r24133931 * r24133917;
        double r24133933 = r24133907 * r24133923;
        double r24133934 = r24133933 * r24133915;
        double r24133935 = r24133932 - r24133934;
        double r24133936 = fma(r24133913, r24133914, r24133935);
        double r24133937 = r24133928 ? r24133936 : r24133926;
        double r24133938 = r24133906 ? r24133926 : r24133937;
        return r24133938;
}

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.9
Target15.3
Herbie10.4
\[\begin{array}{l} \mathbf{if}\;t \lt -8.120978919195912 \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.712553818218485 \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.633533346031584 \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 2 regimes
  2. if b < -4.5537297373874334e-181 or 2.6161480995206308e-142 < b

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

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

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

    if -4.5537297373874334e-181 < b < 2.6161480995206308e-142

    1. Initial program 16.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. Simplified16.8

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -4.5537297373874334 \cdot 10^{-181}:\\ \;\;\;\;\mathsf{fma}\left(t \cdot c - y \cdot i, j, \mathsf{fma}\left(a \cdot i - c \cdot z, b, \left(y \cdot z - t \cdot a\right) \cdot x\right)\right)\\ \mathbf{elif}\;b \le 2.6161480995206308 \cdot 10^{-142}:\\ \;\;\;\;\mathsf{fma}\left(t \cdot c - y \cdot i, j, \left(x \cdot y - c \cdot b\right) \cdot z - \left(t \cdot x\right) \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t \cdot c - y \cdot i, j, \mathsf{fma}\left(a \cdot i - c \cdot z, b, \left(y \cdot z - t \cdot a\right) \cdot x\right)\right)\\ \end{array}\]

Reproduce

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