Average Error: 12.1 → 11.4
Time: 9.8s
Precision: 64
\[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\]
\[\begin{array}{l} \mathbf{if}\;x \le -9.245860709514701 \cdot 10^{-220}:\\ \;\;\;\;\left(\sqrt[3]{c \cdot a - y \cdot i} \cdot \sqrt[3]{c \cdot a - y \cdot i}\right) \cdot \left(\sqrt[3]{c \cdot a - y \cdot i} \cdot j\right) + \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right)\\ \mathbf{elif}\;x \le 6.94820860975778406 \cdot 10^{-208}:\\ \;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, j, \mathsf{fma}\left(t, i \cdot b, -\mathsf{fma}\left(z, b \cdot c, a \cdot \left(x \cdot t\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, j, x \cdot \left(y \cdot z - t \cdot a\right) - \left(b \cdot \left(\sqrt[3]{c \cdot z - t \cdot i} \cdot \sqrt[3]{c \cdot z - t \cdot i}\right)\right) \cdot \sqrt[3]{c \cdot z - t \cdot i}\right)\\ \end{array}\]
\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)
\begin{array}{l}
\mathbf{if}\;x \le -9.245860709514701 \cdot 10^{-220}:\\
\;\;\;\;\left(\sqrt[3]{c \cdot a - y \cdot i} \cdot \sqrt[3]{c \cdot a - y \cdot i}\right) \cdot \left(\sqrt[3]{c \cdot a - y \cdot i} \cdot j\right) + \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right)\\

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, j, x \cdot \left(y \cdot z - t \cdot a\right) - \left(b \cdot \left(\sqrt[3]{c \cdot z - t \cdot i} \cdot \sqrt[3]{c \cdot z - t \cdot i}\right)\right) \cdot \sqrt[3]{c \cdot z - t \cdot i}\right)\\

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r742260 = x;
        double r742261 = y;
        double r742262 = z;
        double r742263 = r742261 * r742262;
        double r742264 = t;
        double r742265 = a;
        double r742266 = r742264 * r742265;
        double r742267 = r742263 - r742266;
        double r742268 = r742260 * r742267;
        double r742269 = b;
        double r742270 = c;
        double r742271 = r742270 * r742262;
        double r742272 = i;
        double r742273 = r742264 * r742272;
        double r742274 = r742271 - r742273;
        double r742275 = r742269 * r742274;
        double r742276 = r742268 - r742275;
        double r742277 = j;
        double r742278 = r742270 * r742265;
        double r742279 = r742261 * r742272;
        double r742280 = r742278 - r742279;
        double r742281 = r742277 * r742280;
        double r742282 = r742276 + r742281;
        return r742282;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r742283 = x;
        double r742284 = -9.245860709514701e-220;
        bool r742285 = r742283 <= r742284;
        double r742286 = c;
        double r742287 = a;
        double r742288 = r742286 * r742287;
        double r742289 = y;
        double r742290 = i;
        double r742291 = r742289 * r742290;
        double r742292 = r742288 - r742291;
        double r742293 = cbrt(r742292);
        double r742294 = r742293 * r742293;
        double r742295 = j;
        double r742296 = r742293 * r742295;
        double r742297 = r742294 * r742296;
        double r742298 = z;
        double r742299 = r742289 * r742298;
        double r742300 = t;
        double r742301 = r742300 * r742287;
        double r742302 = r742299 - r742301;
        double r742303 = r742283 * r742302;
        double r742304 = b;
        double r742305 = r742286 * r742298;
        double r742306 = r742300 * r742290;
        double r742307 = r742305 - r742306;
        double r742308 = r742304 * r742307;
        double r742309 = r742303 - r742308;
        double r742310 = r742297 + r742309;
        double r742311 = 6.948208609757784e-208;
        bool r742312 = r742283 <= r742311;
        double r742313 = r742290 * r742304;
        double r742314 = r742304 * r742286;
        double r742315 = r742283 * r742300;
        double r742316 = r742287 * r742315;
        double r742317 = fma(r742298, r742314, r742316);
        double r742318 = -r742317;
        double r742319 = fma(r742300, r742313, r742318);
        double r742320 = fma(r742292, r742295, r742319);
        double r742321 = cbrt(r742307);
        double r742322 = r742321 * r742321;
        double r742323 = r742304 * r742322;
        double r742324 = r742323 * r742321;
        double r742325 = r742303 - r742324;
        double r742326 = fma(r742292, r742295, r742325);
        double r742327 = r742312 ? r742320 : r742326;
        double r742328 = r742285 ? r742310 : r742327;
        return r742328;
}

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.1
Target19.6
Herbie11.4
\[\begin{array}{l} \mathbf{if}\;x \lt -1.46969429677770502 \cdot 10^{-64}:\\ \;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - \frac{b \cdot \left({\left(c \cdot z\right)}^{2} - {\left(t \cdot i\right)}^{2}\right)}{c \cdot z + t \cdot i}\right) + j \cdot \left(c \cdot a - y \cdot i\right)\\ \mathbf{elif}\;x \lt 3.2113527362226803 \cdot 10^{-147}:\\ \;\;\;\;\left(b \cdot i - x \cdot a\right) \cdot t - \left(z \cdot \left(c \cdot b\right) - j \cdot \left(c \cdot a - y \cdot i\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - \frac{b \cdot \left({\left(c \cdot z\right)}^{2} - {\left(t \cdot i\right)}^{2}\right)}{c \cdot z + t \cdot i}\right) + j \cdot \left(c \cdot a - y \cdot i\right)\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if x < -9.245860709514701e-220

    1. Initial program 11.7

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\]
    2. Simplified11.7

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

      \[\leadsto \color{blue}{\left(c \cdot a - y \cdot i\right) \cdot j + \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right)}\]
    5. Using strategy rm
    6. Applied add-cube-cbrt11.9

      \[\leadsto \color{blue}{\left(\left(\sqrt[3]{c \cdot a - y \cdot i} \cdot \sqrt[3]{c \cdot a - y \cdot i}\right) \cdot \sqrt[3]{c \cdot a - y \cdot i}\right)} \cdot j + \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right)\]
    7. Applied associate-*l*11.9

      \[\leadsto \color{blue}{\left(\sqrt[3]{c \cdot a - y \cdot i} \cdot \sqrt[3]{c \cdot a - y \cdot i}\right) \cdot \left(\sqrt[3]{c \cdot a - y \cdot i} \cdot j\right)} + \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right)\]

    if -9.245860709514701e-220 < x < 6.948208609757784e-208

    1. Initial program 17.6

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\]
    2. Simplified17.6

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

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

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

    if 6.948208609757784e-208 < x

    1. Initial program 10.0

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\]
    2. Simplified10.0

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -9.245860709514701 \cdot 10^{-220}:\\ \;\;\;\;\left(\sqrt[3]{c \cdot a - y \cdot i} \cdot \sqrt[3]{c \cdot a - y \cdot i}\right) \cdot \left(\sqrt[3]{c \cdot a - y \cdot i} \cdot j\right) + \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right)\\ \mathbf{elif}\;x \le 6.94820860975778406 \cdot 10^{-208}:\\ \;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, j, \mathsf{fma}\left(t, i \cdot b, -\mathsf{fma}\left(z, b \cdot c, a \cdot \left(x \cdot t\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, j, x \cdot \left(y \cdot z - t \cdot a\right) - \left(b \cdot \left(\sqrt[3]{c \cdot z - t \cdot i} \cdot \sqrt[3]{c \cdot z - t \cdot i}\right)\right) \cdot \sqrt[3]{c \cdot z - t \cdot i}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020020 +o rules:numerics
(FPCore (x y z t a b c i j)
  :name "Data.Colour.Matrix:determinant from colour-2.3.3, A"
  :precision binary64

  :herbie-target
  (if (< x -1.469694296777705e-64) (+ (- (* x (- (* y z) (* t a))) (/ (* b (- (pow (* c z) 2) (pow (* t i) 2))) (+ (* c z) (* t i)))) (* j (- (* c a) (* y i)))) (if (< x 3.2113527362226803e-147) (- (* (- (* b i) (* x a)) t) (- (* z (* c b)) (* j (- (* c a) (* y i))))) (+ (- (* x (- (* y z) (* t a))) (/ (* b (- (pow (* c z) 2) (pow (* t i) 2))) (+ (* c z) (* t i)))) (* j (- (* c a) (* y i))))))

  (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* t i)))) (* j (- (* c a) (* y i)))))