Average Error: 11.8 → 11.0
Time: 25.4s
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}\;a \le -4.59566540456438512953206990127952711657 \cdot 10^{-58} \lor \neg \left(a \le 4.15459485197229908491326184968303178966 \cdot 10^{-225}\right):\\ \;\;\;\;\mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, t \cdot i - c \cdot z, a \cdot \left(j \cdot c\right) + \left(i \cdot y\right) \cdot \left(-j\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, t \cdot i - c \cdot z, \left(\sqrt[3]{j} \cdot \left(c \cdot a - y \cdot i\right)\right) \cdot \left(\sqrt[3]{j} \cdot \sqrt[3]{j}\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}\;a \le -4.59566540456438512953206990127952711657 \cdot 10^{-58} \lor \neg \left(a \le 4.15459485197229908491326184968303178966 \cdot 10^{-225}\right):\\
\;\;\;\;\mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, t \cdot i - c \cdot z, a \cdot \left(j \cdot c\right) + \left(i \cdot y\right) \cdot \left(-j\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, t \cdot i - c \cdot z, \left(\sqrt[3]{j} \cdot \left(c \cdot a - y \cdot i\right)\right) \cdot \left(\sqrt[3]{j} \cdot \sqrt[3]{j}\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 r635434 = x;
        double r635435 = y;
        double r635436 = z;
        double r635437 = r635435 * r635436;
        double r635438 = t;
        double r635439 = a;
        double r635440 = r635438 * r635439;
        double r635441 = r635437 - r635440;
        double r635442 = r635434 * r635441;
        double r635443 = b;
        double r635444 = c;
        double r635445 = r635444 * r635436;
        double r635446 = i;
        double r635447 = r635438 * r635446;
        double r635448 = r635445 - r635447;
        double r635449 = r635443 * r635448;
        double r635450 = r635442 - r635449;
        double r635451 = j;
        double r635452 = r635444 * r635439;
        double r635453 = r635435 * r635446;
        double r635454 = r635452 - r635453;
        double r635455 = r635451 * r635454;
        double r635456 = r635450 + r635455;
        return r635456;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r635457 = a;
        double r635458 = -4.595665404564385e-58;
        bool r635459 = r635457 <= r635458;
        double r635460 = 4.154594851972299e-225;
        bool r635461 = r635457 <= r635460;
        double r635462 = !r635461;
        bool r635463 = r635459 || r635462;
        double r635464 = x;
        double r635465 = y;
        double r635466 = z;
        double r635467 = r635465 * r635466;
        double r635468 = t;
        double r635469 = r635468 * r635457;
        double r635470 = r635467 - r635469;
        double r635471 = b;
        double r635472 = i;
        double r635473 = r635468 * r635472;
        double r635474 = c;
        double r635475 = r635474 * r635466;
        double r635476 = r635473 - r635475;
        double r635477 = j;
        double r635478 = r635477 * r635474;
        double r635479 = r635457 * r635478;
        double r635480 = r635472 * r635465;
        double r635481 = -r635477;
        double r635482 = r635480 * r635481;
        double r635483 = r635479 + r635482;
        double r635484 = fma(r635471, r635476, r635483);
        double r635485 = fma(r635464, r635470, r635484);
        double r635486 = cbrt(r635477);
        double r635487 = r635474 * r635457;
        double r635488 = r635465 * r635472;
        double r635489 = r635487 - r635488;
        double r635490 = r635486 * r635489;
        double r635491 = r635486 * r635486;
        double r635492 = r635490 * r635491;
        double r635493 = fma(r635471, r635476, r635492);
        double r635494 = fma(r635464, r635470, r635493);
        double r635495 = r635463 ? r635485 : r635494;
        return r635495;
}

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.8
Target19.3
Herbie11.0
\[\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 2 regimes
  2. if a < -4.595665404564385e-58 or 4.154594851972299e-225 < a

    1. Initial program 13.1

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

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

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

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

      \[\leadsto \mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, t \cdot i - c \cdot z, \left(\sqrt[3]{j} \cdot \sqrt[3]{j}\right) \cdot \left(\sqrt[3]{j} \cdot \color{blue}{\left(c \cdot a + \left(-y \cdot i\right)\right)}\right)\right)\right)\]
    8. Applied distribute-lft-in13.4

      \[\leadsto \mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, t \cdot i - c \cdot z, \left(\sqrt[3]{j} \cdot \sqrt[3]{j}\right) \cdot \color{blue}{\left(\sqrt[3]{j} \cdot \left(c \cdot a\right) + \sqrt[3]{j} \cdot \left(-y \cdot i\right)\right)}\right)\right)\]
    9. Applied distribute-lft-in13.4

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

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

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

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

    if -4.595665404564385e-58 < a < 4.154594851972299e-225

    1. Initial program 9.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. Simplified9.4

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -4.59566540456438512953206990127952711657 \cdot 10^{-58} \lor \neg \left(a \le 4.15459485197229908491326184968303178966 \cdot 10^{-225}\right):\\ \;\;\;\;\mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, t \cdot i - c \cdot z, a \cdot \left(j \cdot c\right) + \left(i \cdot y\right) \cdot \left(-j\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, t \cdot i - c \cdot z, \left(\sqrt[3]{j} \cdot \left(c \cdot a - y \cdot i\right)\right) \cdot \left(\sqrt[3]{j} \cdot \sqrt[3]{j}\right)\right)\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019209 +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.46969429677770502e-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)))))