Average Error: 11.6 → 8.7
Time: 11.0s
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 -42309.32838933148:\\ \;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, j, \left(x \cdot \left(z \cdot y\right) + \left(-a \cdot \left(x \cdot t\right)\right)\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right)\\ \mathbf{elif}\;b \le 33.881249917668185:\\ \;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, j, x \cdot \left(y \cdot z - t \cdot a\right) - \left(z \cdot \left(b \cdot c\right) + \left(-t \cdot \left(i \cdot b\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, j, \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot \left(y \cdot z - t \cdot a\right)\right) - b \cdot \left(c \cdot z - t \cdot i\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 -42309.32838933148:\\
\;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, j, \left(x \cdot \left(z \cdot y\right) + \left(-a \cdot \left(x \cdot t\right)\right)\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right)\\

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, j, \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot \left(y \cdot z - t \cdot a\right)\right) - b \cdot \left(c \cdot z - t \cdot i\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 r971387 = x;
        double r971388 = y;
        double r971389 = z;
        double r971390 = r971388 * r971389;
        double r971391 = t;
        double r971392 = a;
        double r971393 = r971391 * r971392;
        double r971394 = r971390 - r971393;
        double r971395 = r971387 * r971394;
        double r971396 = b;
        double r971397 = c;
        double r971398 = r971397 * r971389;
        double r971399 = i;
        double r971400 = r971391 * r971399;
        double r971401 = r971398 - r971400;
        double r971402 = r971396 * r971401;
        double r971403 = r971395 - r971402;
        double r971404 = j;
        double r971405 = r971397 * r971392;
        double r971406 = r971388 * r971399;
        double r971407 = r971405 - r971406;
        double r971408 = r971404 * r971407;
        double r971409 = r971403 + r971408;
        return r971409;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r971410 = b;
        double r971411 = -42309.32838933148;
        bool r971412 = r971410 <= r971411;
        double r971413 = c;
        double r971414 = a;
        double r971415 = r971413 * r971414;
        double r971416 = y;
        double r971417 = i;
        double r971418 = r971416 * r971417;
        double r971419 = r971415 - r971418;
        double r971420 = j;
        double r971421 = x;
        double r971422 = z;
        double r971423 = r971422 * r971416;
        double r971424 = r971421 * r971423;
        double r971425 = t;
        double r971426 = r971421 * r971425;
        double r971427 = r971414 * r971426;
        double r971428 = -r971427;
        double r971429 = r971424 + r971428;
        double r971430 = r971413 * r971422;
        double r971431 = r971425 * r971417;
        double r971432 = r971430 - r971431;
        double r971433 = r971410 * r971432;
        double r971434 = r971429 - r971433;
        double r971435 = fma(r971419, r971420, r971434);
        double r971436 = 33.881249917668185;
        bool r971437 = r971410 <= r971436;
        double r971438 = r971416 * r971422;
        double r971439 = r971425 * r971414;
        double r971440 = r971438 - r971439;
        double r971441 = r971421 * r971440;
        double r971442 = r971410 * r971413;
        double r971443 = r971422 * r971442;
        double r971444 = r971417 * r971410;
        double r971445 = r971425 * r971444;
        double r971446 = -r971445;
        double r971447 = r971443 + r971446;
        double r971448 = r971441 - r971447;
        double r971449 = fma(r971419, r971420, r971448);
        double r971450 = cbrt(r971421);
        double r971451 = r971450 * r971450;
        double r971452 = r971450 * r971440;
        double r971453 = r971451 * r971452;
        double r971454 = r971453 - r971433;
        double r971455 = fma(r971419, r971420, r971454);
        double r971456 = r971437 ? r971449 : r971455;
        double r971457 = r971412 ? r971435 : r971456;
        return r971457;
}

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.6
Target19.5
Herbie8.7
\[\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 b < -42309.32838933148

    1. Initial program 8.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. Simplified8.1

      \[\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-cbrt8.3

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

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

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

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

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

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

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

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

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

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

    if -42309.32838933148 < b < 33.881249917668185

    1. Initial program 14.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. Simplified14.4

      \[\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-cbrt14.5

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

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

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

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

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

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

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

    if 33.881249917668185 < b

    1. Initial program 6.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. Simplified6.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 add-cube-cbrt6.9

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

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

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

Reproduce

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