Average Error: 12.3 → 13.3
Time: 30.5s
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}\;b \le -2.711579101422674750843546206867867967733 \cdot 10^{-44}:\\ \;\;\;\;\mathsf{fma}\left(\sqrt[3]{\mathsf{fma}\left(-y, i, a \cdot c\right)} \cdot \left(\left(\sqrt[3]{\sqrt[3]{\mathsf{fma}\left(y, -i, a \cdot c\right)}} \cdot \sqrt[3]{\sqrt[3]{\mathsf{fma}\left(y, -i, a \cdot c\right)} \cdot \sqrt[3]{\mathsf{fma}\left(y, -i, a \cdot c\right)}}\right) \cdot \sqrt[3]{\mathsf{fma}\left(-y, i, a \cdot c\right)}\right), j, \mathsf{fma}\left(b, \mathsf{fma}\left(i, t, -z \cdot c\right), x \cdot \mathsf{fma}\left(-a, t, y \cdot z\right)\right)\right)\\ \mathbf{elif}\;b \le 4.396813432291646969265240462950608914807 \cdot 10^{-192}:\\ \;\;\;\;\mathsf{fma}\left(a \cdot c - y \cdot i, j, \mathsf{fma}\left(y, z \cdot x, -\mathsf{fma}\left(x, t \cdot a, b \cdot \left(z \cdot c\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a \cdot c - y \cdot i, j, \mathsf{fma}\left(b, \mathsf{fma}\left(i, t, -z \cdot c\right), \left(\sqrt[3]{\mathsf{fma}\left(-a, t, y \cdot z\right)} \cdot \sqrt[3]{\mathsf{fma}\left(-a, t, y \cdot z\right)}\right) \cdot \left(\sqrt[3]{\mathsf{fma}\left(t, -a, y \cdot z\right)} \cdot x\right)\right)\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}\;b \le -2.711579101422674750843546206867867967733 \cdot 10^{-44}:\\
\;\;\;\;\mathsf{fma}\left(\sqrt[3]{\mathsf{fma}\left(-y, i, a \cdot c\right)} \cdot \left(\left(\sqrt[3]{\sqrt[3]{\mathsf{fma}\left(y, -i, a \cdot c\right)}} \cdot \sqrt[3]{\sqrt[3]{\mathsf{fma}\left(y, -i, a \cdot c\right)} \cdot \sqrt[3]{\mathsf{fma}\left(y, -i, a \cdot c\right)}}\right) \cdot \sqrt[3]{\mathsf{fma}\left(-y, i, a \cdot c\right)}\right), j, \mathsf{fma}\left(b, \mathsf{fma}\left(i, t, -z \cdot c\right), x \cdot \mathsf{fma}\left(-a, t, y \cdot z\right)\right)\right)\\

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a \cdot c - y \cdot i, j, \mathsf{fma}\left(b, \mathsf{fma}\left(i, t, -z \cdot c\right), \left(\sqrt[3]{\mathsf{fma}\left(-a, t, y \cdot z\right)} \cdot \sqrt[3]{\mathsf{fma}\left(-a, t, y \cdot z\right)}\right) \cdot \left(\sqrt[3]{\mathsf{fma}\left(t, -a, y \cdot z\right)} \cdot x\right)\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 r693318 = x;
        double r693319 = y;
        double r693320 = z;
        double r693321 = r693319 * r693320;
        double r693322 = t;
        double r693323 = a;
        double r693324 = r693322 * r693323;
        double r693325 = r693321 - r693324;
        double r693326 = r693318 * r693325;
        double r693327 = b;
        double r693328 = c;
        double r693329 = r693328 * r693320;
        double r693330 = i;
        double r693331 = r693322 * r693330;
        double r693332 = r693329 - r693331;
        double r693333 = r693327 * r693332;
        double r693334 = r693326 - r693333;
        double r693335 = j;
        double r693336 = r693328 * r693323;
        double r693337 = r693319 * r693330;
        double r693338 = r693336 - r693337;
        double r693339 = r693335 * r693338;
        double r693340 = r693334 + r693339;
        return r693340;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r693341 = b;
        double r693342 = -2.7115791014226748e-44;
        bool r693343 = r693341 <= r693342;
        double r693344 = y;
        double r693345 = -r693344;
        double r693346 = i;
        double r693347 = a;
        double r693348 = c;
        double r693349 = r693347 * r693348;
        double r693350 = fma(r693345, r693346, r693349);
        double r693351 = cbrt(r693350);
        double r693352 = -r693346;
        double r693353 = fma(r693344, r693352, r693349);
        double r693354 = cbrt(r693353);
        double r693355 = cbrt(r693354);
        double r693356 = r693354 * r693354;
        double r693357 = cbrt(r693356);
        double r693358 = r693355 * r693357;
        double r693359 = r693358 * r693351;
        double r693360 = r693351 * r693359;
        double r693361 = j;
        double r693362 = t;
        double r693363 = z;
        double r693364 = r693363 * r693348;
        double r693365 = -r693364;
        double r693366 = fma(r693346, r693362, r693365);
        double r693367 = x;
        double r693368 = -r693347;
        double r693369 = r693344 * r693363;
        double r693370 = fma(r693368, r693362, r693369);
        double r693371 = r693367 * r693370;
        double r693372 = fma(r693341, r693366, r693371);
        double r693373 = fma(r693360, r693361, r693372);
        double r693374 = 4.396813432291647e-192;
        bool r693375 = r693341 <= r693374;
        double r693376 = r693344 * r693346;
        double r693377 = r693349 - r693376;
        double r693378 = r693363 * r693367;
        double r693379 = r693362 * r693347;
        double r693380 = r693341 * r693364;
        double r693381 = fma(r693367, r693379, r693380);
        double r693382 = -r693381;
        double r693383 = fma(r693344, r693378, r693382);
        double r693384 = fma(r693377, r693361, r693383);
        double r693385 = cbrt(r693370);
        double r693386 = r693385 * r693385;
        double r693387 = fma(r693362, r693368, r693369);
        double r693388 = cbrt(r693387);
        double r693389 = r693388 * r693367;
        double r693390 = r693386 * r693389;
        double r693391 = fma(r693341, r693366, r693390);
        double r693392 = fma(r693377, r693361, r693391);
        double r693393 = r693375 ? r693384 : r693392;
        double r693394 = r693343 ? r693373 : r693393;
        return r693394;
}

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.3
Target19.7
Herbie13.3
\[\begin{array}{l} \mathbf{if}\;x \lt -1.469694296777705016266218530347997287942 \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.21135273622268028942701600607048800714 \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 b < -2.7115791014226748e-44

    1. Initial program 7.8

      \[\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. Simplified7.8

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\left(\sqrt[3]{\color{blue}{\left(\sqrt[3]{\mathsf{fma}\left(-y, i, a \cdot c\right)} \cdot \sqrt[3]{\mathsf{fma}\left(-y, i, a \cdot c\right)}\right) \cdot \sqrt[3]{\mathsf{fma}\left(-y, i, a \cdot c\right)}}} \cdot \sqrt[3]{\mathsf{fma}\left(-y, i, a \cdot c\right)}\right) \cdot \sqrt[3]{\mathsf{fma}\left(-y, i, a \cdot c\right)}, j, \mathsf{fma}\left(b, \mathsf{fma}\left(i, t, -z \cdot c\right), \mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x\right)\right)\]
    9. Applied cbrt-prod8.1

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

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

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

    if -2.7115791014226748e-44 < b < 4.396813432291647e-192

    1. Initial program 17.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. Simplified17.0

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

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

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

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

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

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

    if 4.396813432291647e-192 < b

    1. Initial program 10.4

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

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

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

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

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

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

Reproduce

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

  :herbie-target
  (if (< x -1.469694296777705e-64) (+ (- (* x (- (* y z) (* t a))) (/ (* b (- (pow (* c z) 2.0) (pow (* t i) 2.0))) (+ (* 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.0) (pow (* t i) 2.0))) (+ (* c z) (* t i)))) (* j (- (* c a) (* y i))))))

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