Average Error: 11.9 → 9.4
Time: 27.6s
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}\;\left(a \cdot c - y \cdot i\right) \cdot j + \left(\left(z \cdot y - t \cdot a\right) \cdot x - \left(z \cdot c - t \cdot i\right) \cdot b\right) = -\infty:\\ \;\;\;\;\left(z \cdot y - t \cdot a\right) \cdot x - \left(\left(z \cdot c\right) \cdot b + \left(t \cdot \left(-b\right)\right) \cdot i\right)\\ \mathbf{elif}\;\left(a \cdot c - y \cdot i\right) \cdot j + \left(\left(z \cdot y - t \cdot a\right) \cdot x - \left(z \cdot c - t \cdot i\right) \cdot b\right) \le 6.84021848080265 \cdot 10^{+299}:\\ \;\;\;\;\left(\left(z \cdot y - t \cdot a\right) \cdot x - \left(\left(z \cdot c\right) \cdot b + \left(t \cdot i\right) \cdot \left(-b\right)\right)\right) + \left(a \cdot c - y \cdot i\right) \cdot j\\ \mathbf{else}:\\ \;\;\;\;\left(\left(z \cdot y - t \cdot a\right) \cdot x - \left(\left(t \cdot \left(-b\right)\right) \cdot i + \left(b \cdot c\right) \cdot z\right)\right) + \left(a \cdot c - y \cdot i\right) \cdot j\\ \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}\;\left(a \cdot c - y \cdot i\right) \cdot j + \left(\left(z \cdot y - t \cdot a\right) \cdot x - \left(z \cdot c - t \cdot i\right) \cdot b\right) = -\infty:\\
\;\;\;\;\left(z \cdot y - t \cdot a\right) \cdot x - \left(\left(z \cdot c\right) \cdot b + \left(t \cdot \left(-b\right)\right) \cdot i\right)\\

\mathbf{elif}\;\left(a \cdot c - y \cdot i\right) \cdot j + \left(\left(z \cdot y - t \cdot a\right) \cdot x - \left(z \cdot c - t \cdot i\right) \cdot b\right) \le 6.84021848080265 \cdot 10^{+299}:\\
\;\;\;\;\left(\left(z \cdot y - t \cdot a\right) \cdot x - \left(\left(z \cdot c\right) \cdot b + \left(t \cdot i\right) \cdot \left(-b\right)\right)\right) + \left(a \cdot c - y \cdot i\right) \cdot j\\

\mathbf{else}:\\
\;\;\;\;\left(\left(z \cdot y - t \cdot a\right) \cdot x - \left(\left(t \cdot \left(-b\right)\right) \cdot i + \left(b \cdot c\right) \cdot z\right)\right) + \left(a \cdot c - y \cdot i\right) \cdot j\\

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r36830552 = x;
        double r36830553 = y;
        double r36830554 = z;
        double r36830555 = r36830553 * r36830554;
        double r36830556 = t;
        double r36830557 = a;
        double r36830558 = r36830556 * r36830557;
        double r36830559 = r36830555 - r36830558;
        double r36830560 = r36830552 * r36830559;
        double r36830561 = b;
        double r36830562 = c;
        double r36830563 = r36830562 * r36830554;
        double r36830564 = i;
        double r36830565 = r36830556 * r36830564;
        double r36830566 = r36830563 - r36830565;
        double r36830567 = r36830561 * r36830566;
        double r36830568 = r36830560 - r36830567;
        double r36830569 = j;
        double r36830570 = r36830562 * r36830557;
        double r36830571 = r36830553 * r36830564;
        double r36830572 = r36830570 - r36830571;
        double r36830573 = r36830569 * r36830572;
        double r36830574 = r36830568 + r36830573;
        return r36830574;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r36830575 = a;
        double r36830576 = c;
        double r36830577 = r36830575 * r36830576;
        double r36830578 = y;
        double r36830579 = i;
        double r36830580 = r36830578 * r36830579;
        double r36830581 = r36830577 - r36830580;
        double r36830582 = j;
        double r36830583 = r36830581 * r36830582;
        double r36830584 = z;
        double r36830585 = r36830584 * r36830578;
        double r36830586 = t;
        double r36830587 = r36830586 * r36830575;
        double r36830588 = r36830585 - r36830587;
        double r36830589 = x;
        double r36830590 = r36830588 * r36830589;
        double r36830591 = r36830584 * r36830576;
        double r36830592 = r36830586 * r36830579;
        double r36830593 = r36830591 - r36830592;
        double r36830594 = b;
        double r36830595 = r36830593 * r36830594;
        double r36830596 = r36830590 - r36830595;
        double r36830597 = r36830583 + r36830596;
        double r36830598 = -inf.0;
        bool r36830599 = r36830597 <= r36830598;
        double r36830600 = r36830591 * r36830594;
        double r36830601 = -r36830594;
        double r36830602 = r36830586 * r36830601;
        double r36830603 = r36830602 * r36830579;
        double r36830604 = r36830600 + r36830603;
        double r36830605 = r36830590 - r36830604;
        double r36830606 = 6.84021848080265e+299;
        bool r36830607 = r36830597 <= r36830606;
        double r36830608 = r36830592 * r36830601;
        double r36830609 = r36830600 + r36830608;
        double r36830610 = r36830590 - r36830609;
        double r36830611 = r36830610 + r36830583;
        double r36830612 = r36830594 * r36830576;
        double r36830613 = r36830612 * r36830584;
        double r36830614 = r36830603 + r36830613;
        double r36830615 = r36830590 - r36830614;
        double r36830616 = r36830615 + r36830583;
        double r36830617 = r36830607 ? r36830611 : r36830616;
        double r36830618 = r36830599 ? r36830605 : r36830617;
        return r36830618;
}

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

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original11.9
Target19.6
Herbie9.4
\[\begin{array}{l} \mathbf{if}\;x \lt -1.469694296777705 \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 (- (* y z) (* t a))) (* b (- (* c z) (* t i)))) (* j (- (* c a) (* y i)))) < -inf.0

    1. Initial program 60.3

      \[\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. Using strategy rm
    3. Applied sub-neg60.3

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

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

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

      \[\leadsto \left(x \cdot \left(y \cdot z - t \cdot a\right) - \left(b \cdot \left(c \cdot z\right) + \color{blue}{i \cdot \left(-t \cdot b\right)}\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\]
    7. Taylor expanded around 0 47.7

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

    if -inf.0 < (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* t i)))) (* j (- (* c a) (* y i)))) < 6.84021848080265e+299

    1. Initial program 0.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. Using strategy rm
    3. Applied sub-neg0.8

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

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

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

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

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

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

    if 6.84021848080265e+299 < (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* t i)))) (* j (- (* c a) (* y i))))

    1. Initial program 54.2

      \[\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. Using strategy rm
    3. Applied sub-neg54.2

      \[\leadsto \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \color{blue}{\left(c \cdot z + \left(-t \cdot i\right)\right)}\right) + j \cdot \left(c \cdot a - y \cdot i\right)\]
    4. Applied distribute-lft-in54.2

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(a \cdot c - y \cdot i\right) \cdot j + \left(\left(z \cdot y - t \cdot a\right) \cdot x - \left(z \cdot c - t \cdot i\right) \cdot b\right) = -\infty:\\ \;\;\;\;\left(z \cdot y - t \cdot a\right) \cdot x - \left(\left(z \cdot c\right) \cdot b + \left(t \cdot \left(-b\right)\right) \cdot i\right)\\ \mathbf{elif}\;\left(a \cdot c - y \cdot i\right) \cdot j + \left(\left(z \cdot y - t \cdot a\right) \cdot x - \left(z \cdot c - t \cdot i\right) \cdot b\right) \le 6.84021848080265 \cdot 10^{+299}:\\ \;\;\;\;\left(\left(z \cdot y - t \cdot a\right) \cdot x - \left(\left(z \cdot c\right) \cdot b + \left(t \cdot i\right) \cdot \left(-b\right)\right)\right) + \left(a \cdot c - y \cdot i\right) \cdot j\\ \mathbf{else}:\\ \;\;\;\;\left(\left(z \cdot y - t \cdot a\right) \cdot x - \left(\left(t \cdot \left(-b\right)\right) \cdot i + \left(b \cdot c\right) \cdot z\right)\right) + \left(a \cdot c - y \cdot i\right) \cdot j\\ \end{array}\]

Reproduce

herbie shell --seed 2019165 
(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) (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)))))