Average Error: 11.3 → 10.8
Time: 33.4s
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 -5.943060243160363 \cdot 10^{-145}:\\ \;\;\;\;\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.0633801786935661 \cdot 10^{-165}:\\ \;\;\;\;\mathsf{fma}\left(t \cdot c - y \cdot i, j, \left(x \cdot y - c \cdot b\right) \cdot z - t \cdot \left(x \cdot a\right)\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 -5.943060243160363 \cdot 10^{-145}:\\
\;\;\;\;\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.0633801786935661 \cdot 10^{-165}:\\
\;\;\;\;\mathsf{fma}\left(t \cdot c - y \cdot i, j, \left(x \cdot y - c \cdot b\right) \cdot z - t \cdot \left(x \cdot a\right)\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 r15766796 = x;
        double r15766797 = y;
        double r15766798 = z;
        double r15766799 = r15766797 * r15766798;
        double r15766800 = t;
        double r15766801 = a;
        double r15766802 = r15766800 * r15766801;
        double r15766803 = r15766799 - r15766802;
        double r15766804 = r15766796 * r15766803;
        double r15766805 = b;
        double r15766806 = c;
        double r15766807 = r15766806 * r15766798;
        double r15766808 = i;
        double r15766809 = r15766808 * r15766801;
        double r15766810 = r15766807 - r15766809;
        double r15766811 = r15766805 * r15766810;
        double r15766812 = r15766804 - r15766811;
        double r15766813 = j;
        double r15766814 = r15766806 * r15766800;
        double r15766815 = r15766808 * r15766797;
        double r15766816 = r15766814 - r15766815;
        double r15766817 = r15766813 * r15766816;
        double r15766818 = r15766812 + r15766817;
        return r15766818;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r15766819 = b;
        double r15766820 = -5.943060243160363e-145;
        bool r15766821 = r15766819 <= r15766820;
        double r15766822 = t;
        double r15766823 = c;
        double r15766824 = r15766822 * r15766823;
        double r15766825 = y;
        double r15766826 = i;
        double r15766827 = r15766825 * r15766826;
        double r15766828 = r15766824 - r15766827;
        double r15766829 = j;
        double r15766830 = a;
        double r15766831 = r15766830 * r15766826;
        double r15766832 = z;
        double r15766833 = r15766823 * r15766832;
        double r15766834 = r15766831 - r15766833;
        double r15766835 = r15766825 * r15766832;
        double r15766836 = r15766822 * r15766830;
        double r15766837 = r15766835 - r15766836;
        double r15766838 = x;
        double r15766839 = r15766837 * r15766838;
        double r15766840 = fma(r15766834, r15766819, r15766839);
        double r15766841 = fma(r15766828, r15766829, r15766840);
        double r15766842 = 2.0633801786935661e-165;
        bool r15766843 = r15766819 <= r15766842;
        double r15766844 = r15766838 * r15766825;
        double r15766845 = r15766823 * r15766819;
        double r15766846 = r15766844 - r15766845;
        double r15766847 = r15766846 * r15766832;
        double r15766848 = r15766838 * r15766830;
        double r15766849 = r15766822 * r15766848;
        double r15766850 = r15766847 - r15766849;
        double r15766851 = fma(r15766828, r15766829, r15766850);
        double r15766852 = r15766843 ? r15766851 : r15766841;
        double r15766853 = r15766821 ? r15766841 : r15766852;
        return r15766853;
}

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.3
Target14.9
Herbie10.8
\[\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 < -5.943060243160363e-145 or 2.0633801786935661e-165 < b

    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(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.5

      \[\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 -5.943060243160363e-145 < b < 2.0633801786935661e-165

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -5.943060243160363 \cdot 10^{-145}:\\ \;\;\;\;\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.0633801786935661 \cdot 10^{-165}:\\ \;\;\;\;\mathsf{fma}\left(t \cdot c - y \cdot i, j, \left(x \cdot y - c \cdot b\right) \cdot z - t \cdot \left(x \cdot a\right)\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 2019158 +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)))))