Average Error: 11.9 → 10.4
Time: 28.7s
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 r22368947 = x;
        double r22368948 = y;
        double r22368949 = z;
        double r22368950 = r22368948 * r22368949;
        double r22368951 = t;
        double r22368952 = a;
        double r22368953 = r22368951 * r22368952;
        double r22368954 = r22368950 - r22368953;
        double r22368955 = r22368947 * r22368954;
        double r22368956 = b;
        double r22368957 = c;
        double r22368958 = r22368957 * r22368949;
        double r22368959 = i;
        double r22368960 = r22368959 * r22368952;
        double r22368961 = r22368958 - r22368960;
        double r22368962 = r22368956 * r22368961;
        double r22368963 = r22368955 - r22368962;
        double r22368964 = j;
        double r22368965 = r22368957 * r22368951;
        double r22368966 = r22368959 * r22368948;
        double r22368967 = r22368965 - r22368966;
        double r22368968 = r22368964 * r22368967;
        double r22368969 = r22368963 + r22368968;
        return r22368969;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r22368970 = b;
        double r22368971 = -4.5537297373874334e-181;
        bool r22368972 = r22368970 <= r22368971;
        double r22368973 = t;
        double r22368974 = c;
        double r22368975 = r22368973 * r22368974;
        double r22368976 = y;
        double r22368977 = i;
        double r22368978 = r22368976 * r22368977;
        double r22368979 = r22368975 - r22368978;
        double r22368980 = j;
        double r22368981 = a;
        double r22368982 = r22368981 * r22368977;
        double r22368983 = z;
        double r22368984 = r22368974 * r22368983;
        double r22368985 = r22368982 - r22368984;
        double r22368986 = r22368976 * r22368983;
        double r22368987 = r22368973 * r22368981;
        double r22368988 = r22368986 - r22368987;
        double r22368989 = x;
        double r22368990 = r22368988 * r22368989;
        double r22368991 = fma(r22368985, r22368970, r22368990);
        double r22368992 = fma(r22368979, r22368980, r22368991);
        double r22368993 = 2.6161480995206308e-142;
        bool r22368994 = r22368970 <= r22368993;
        double r22368995 = r22368989 * r22368976;
        double r22368996 = r22368974 * r22368970;
        double r22368997 = r22368995 - r22368996;
        double r22368998 = r22368997 * r22368983;
        double r22368999 = r22368973 * r22368989;
        double r22369000 = r22368999 * r22368981;
        double r22369001 = r22368998 - r22369000;
        double r22369002 = fma(r22368979, r22368980, r22369001);
        double r22369003 = r22368994 ? r22369002 : r22368992;
        double r22369004 = r22368972 ? r22368992 : r22369003;
        return r22369004;
}

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 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)\]
    4. Simplified12.2

      \[\leadsto \mathsf{fma}\left(t \cdot c - i \cdot y, j, \color{blue}{z \cdot \left(y \cdot x - c \cdot b\right) - \left(t \cdot x\right) \cdot a}\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)))))