Average Error: 12.4 → 10.8
Time: 28.1s
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 -1.472198629438373467176788070401966553082 \cdot 10^{186}:\\ \;\;\;\;\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 4.88790623320237152630256737661557323239 \cdot 10^{94}:\\ \;\;\;\;\mathsf{fma}\left(t \cdot c - y \cdot i, j, \mathsf{fma}\left(b, i \cdot a - c \cdot z, \left(\left(y \cdot z - t \cdot a\right) \cdot \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\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 -1.472198629438373467176788070401966553082 \cdot 10^{186}:\\
\;\;\;\;\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 4.88790623320237152630256737661557323239 \cdot 10^{94}:\\
\;\;\;\;\mathsf{fma}\left(t \cdot c - y \cdot i, j, \mathsf{fma}\left(b, i \cdot a - c \cdot z, \left(\left(y \cdot z - t \cdot a\right) \cdot \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\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 r24233219 = x;
        double r24233220 = y;
        double r24233221 = z;
        double r24233222 = r24233220 * r24233221;
        double r24233223 = t;
        double r24233224 = a;
        double r24233225 = r24233223 * r24233224;
        double r24233226 = r24233222 - r24233225;
        double r24233227 = r24233219 * r24233226;
        double r24233228 = b;
        double r24233229 = c;
        double r24233230 = r24233229 * r24233221;
        double r24233231 = i;
        double r24233232 = r24233231 * r24233224;
        double r24233233 = r24233230 - r24233232;
        double r24233234 = r24233228 * r24233233;
        double r24233235 = r24233227 - r24233234;
        double r24233236 = j;
        double r24233237 = r24233229 * r24233223;
        double r24233238 = r24233231 * r24233220;
        double r24233239 = r24233237 - r24233238;
        double r24233240 = r24233236 * r24233239;
        double r24233241 = r24233235 + r24233240;
        return r24233241;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r24233242 = z;
        double r24233243 = -1.4721986294383735e+186;
        bool r24233244 = r24233242 <= r24233243;
        double r24233245 = t;
        double r24233246 = c;
        double r24233247 = r24233245 * r24233246;
        double r24233248 = y;
        double r24233249 = i;
        double r24233250 = r24233248 * r24233249;
        double r24233251 = r24233247 - r24233250;
        double r24233252 = j;
        double r24233253 = x;
        double r24233254 = r24233253 * r24233248;
        double r24233255 = b;
        double r24233256 = r24233246 * r24233255;
        double r24233257 = r24233254 - r24233256;
        double r24233258 = r24233257 * r24233242;
        double r24233259 = a;
        double r24233260 = r24233253 * r24233259;
        double r24233261 = r24233245 * r24233260;
        double r24233262 = r24233258 - r24233261;
        double r24233263 = fma(r24233251, r24233252, r24233262);
        double r24233264 = 4.8879062332023715e+94;
        bool r24233265 = r24233242 <= r24233264;
        double r24233266 = r24233249 * r24233259;
        double r24233267 = r24233246 * r24233242;
        double r24233268 = r24233266 - r24233267;
        double r24233269 = r24233248 * r24233242;
        double r24233270 = r24233245 * r24233259;
        double r24233271 = r24233269 - r24233270;
        double r24233272 = cbrt(r24233253);
        double r24233273 = r24233272 * r24233272;
        double r24233274 = r24233271 * r24233273;
        double r24233275 = r24233274 * r24233272;
        double r24233276 = fma(r24233255, r24233268, r24233275);
        double r24233277 = fma(r24233251, r24233252, r24233276);
        double r24233278 = r24233265 ? r24233277 : r24233263;
        double r24233279 = r24233244 ? r24233263 : r24233278;
        return r24233279;
}

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.0
Herbie10.8
\[\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 < -1.4721986294383735e+186 or 4.8879062332023715e+94 < z

    1. Initial program 22.6

      \[\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. Simplified22.6

      \[\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-cbrt22.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*22.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. Taylor expanded around inf 19.6

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

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

    if -1.4721986294383735e+186 < z < 4.8879062332023715e+94

    1. Initial program 10.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. Simplified10.4

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

      \[\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*10.7

      \[\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)\]
  3. Recombined 2 regimes into one program.
  4. Final simplification10.8

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