Average Error: 12.0 → 10.3
Time: 30.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}\;z \le -4.049590576885732440987301511602082461698 \cdot 10^{94}:\\ \;\;\;\;\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{elif}\;z \le 3.061671691665755733973394415758569553163 \cdot 10^{144}:\\ \;\;\;\;\mathsf{fma}\left(t \cdot c - y \cdot i, j, \mathsf{fma}\left(b, i \cdot a - c \cdot z, \left(\sqrt[3]{x} \cdot \left(\sqrt[3]{x} \cdot \left(y \cdot z - t \cdot a\right)\right)\right) \cdot \sqrt[3]{x}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\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)\\ \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}\;z \le -4.049590576885732440987301511602082461698 \cdot 10^{94}:\\
\;\;\;\;\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{elif}\;z \le 3.061671691665755733973394415758569553163 \cdot 10^{144}:\\
\;\;\;\;\mathsf{fma}\left(t \cdot c - y \cdot i, j, \mathsf{fma}\left(b, i \cdot a - c \cdot z, \left(\sqrt[3]{x} \cdot \left(\sqrt[3]{x} \cdot \left(y \cdot z - t \cdot a\right)\right)\right) \cdot \sqrt[3]{x}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\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)\\

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r19964089 = x;
        double r19964090 = y;
        double r19964091 = z;
        double r19964092 = r19964090 * r19964091;
        double r19964093 = t;
        double r19964094 = a;
        double r19964095 = r19964093 * r19964094;
        double r19964096 = r19964092 - r19964095;
        double r19964097 = r19964089 * r19964096;
        double r19964098 = b;
        double r19964099 = c;
        double r19964100 = r19964099 * r19964091;
        double r19964101 = i;
        double r19964102 = r19964101 * r19964094;
        double r19964103 = r19964100 - r19964102;
        double r19964104 = r19964098 * r19964103;
        double r19964105 = r19964097 - r19964104;
        double r19964106 = j;
        double r19964107 = r19964099 * r19964093;
        double r19964108 = r19964101 * r19964090;
        double r19964109 = r19964107 - r19964108;
        double r19964110 = r19964106 * r19964109;
        double r19964111 = r19964105 + r19964110;
        return r19964111;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r19964112 = z;
        double r19964113 = -4.0495905768857324e+94;
        bool r19964114 = r19964112 <= r19964113;
        double r19964115 = t;
        double r19964116 = c;
        double r19964117 = r19964115 * r19964116;
        double r19964118 = y;
        double r19964119 = i;
        double r19964120 = r19964118 * r19964119;
        double r19964121 = r19964117 - r19964120;
        double r19964122 = j;
        double r19964123 = x;
        double r19964124 = r19964123 * r19964118;
        double r19964125 = b;
        double r19964126 = r19964116 * r19964125;
        double r19964127 = r19964124 - r19964126;
        double r19964128 = r19964127 * r19964112;
        double r19964129 = a;
        double r19964130 = r19964123 * r19964129;
        double r19964131 = r19964115 * r19964130;
        double r19964132 = r19964128 - r19964131;
        double r19964133 = fma(r19964121, r19964122, r19964132);
        double r19964134 = 3.0616716916657557e+144;
        bool r19964135 = r19964112 <= r19964134;
        double r19964136 = r19964119 * r19964129;
        double r19964137 = r19964116 * r19964112;
        double r19964138 = r19964136 - r19964137;
        double r19964139 = cbrt(r19964123);
        double r19964140 = r19964118 * r19964112;
        double r19964141 = r19964115 * r19964129;
        double r19964142 = r19964140 - r19964141;
        double r19964143 = r19964139 * r19964142;
        double r19964144 = r19964139 * r19964143;
        double r19964145 = r19964144 * r19964139;
        double r19964146 = fma(r19964125, r19964138, r19964145);
        double r19964147 = fma(r19964121, r19964122, r19964146);
        double r19964148 = r19964135 ? r19964147 : r19964133;
        double r19964149 = r19964114 ? r19964133 : r19964148;
        return r19964149;
}

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
Herbie10.3
\[\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 2 regimes
  2. if z < -4.0495905768857324e+94 or 3.0616716916657557e+144 < z

    1. Initial program 21.1

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

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

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

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

      \[\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)\]
    7. Simplified11.7

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

    if -4.0495905768857324e+94 < z < 3.0616716916657557e+144

    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(b, a \cdot i - z \cdot c, \left(z \cdot y - t \cdot a\right) \cdot x\right)\right)}\]
    3. Using strategy rm
    4. Applied add-cube-cbrt9.9

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

      \[\leadsto \mathsf{fma}\left(t \cdot c - i \cdot y, j, \mathsf{fma}\left(b, a \cdot i - z \cdot c, \color{blue}{\left(\left(z \cdot y - t \cdot a\right) \cdot \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right)\right) \cdot \sqrt[3]{x}}\right)\right)\]
    6. Using strategy rm
    7. Applied associate-*r*9.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -4.049590576885732440987301511602082461698 \cdot 10^{94}:\\ \;\;\;\;\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{elif}\;z \le 3.061671691665755733973394415758569553163 \cdot 10^{144}:\\ \;\;\;\;\mathsf{fma}\left(t \cdot c - y \cdot i, j, \mathsf{fma}\left(b, i \cdot a - c \cdot z, \left(\sqrt[3]{x} \cdot \left(\sqrt[3]{x} \cdot \left(y \cdot z - t \cdot a\right)\right)\right) \cdot \sqrt[3]{x}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\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)\\ \end{array}\]

Reproduce

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