Average Error: 12.4 → 12.5
Time: 8.2s
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}\;j \le -1.297231026100319828365025446437552019435 \cdot 10^{-34}:\\ \;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - \left(z \cdot \left(b \cdot c\right) + {\left(-1 \cdot \left(t \cdot \left(i \cdot b\right)\right)\right)}^{1}\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - \left(\left(z \cdot b\right) \cdot c + \left(\left(-b\right) \cdot t\right) \cdot i\right)\right) + j \cdot \left(c \cdot a - y \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}\;j \le -1.297231026100319828365025446437552019435 \cdot 10^{-34}:\\
\;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - \left(z \cdot \left(b \cdot c\right) + {\left(-1 \cdot \left(t \cdot \left(i \cdot b\right)\right)\right)}^{1}\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\\

\mathbf{else}:\\
\;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - \left(\left(z \cdot b\right) \cdot c + \left(\left(-b\right) \cdot t\right) \cdot i\right)\right) + j \cdot \left(c \cdot a - y \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 r1057508 = x;
        double r1057509 = y;
        double r1057510 = z;
        double r1057511 = r1057509 * r1057510;
        double r1057512 = t;
        double r1057513 = a;
        double r1057514 = r1057512 * r1057513;
        double r1057515 = r1057511 - r1057514;
        double r1057516 = r1057508 * r1057515;
        double r1057517 = b;
        double r1057518 = c;
        double r1057519 = r1057518 * r1057510;
        double r1057520 = i;
        double r1057521 = r1057512 * r1057520;
        double r1057522 = r1057519 - r1057521;
        double r1057523 = r1057517 * r1057522;
        double r1057524 = r1057516 - r1057523;
        double r1057525 = j;
        double r1057526 = r1057518 * r1057513;
        double r1057527 = r1057509 * r1057520;
        double r1057528 = r1057526 - r1057527;
        double r1057529 = r1057525 * r1057528;
        double r1057530 = r1057524 + r1057529;
        return r1057530;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r1057531 = j;
        double r1057532 = -1.2972310261003198e-34;
        bool r1057533 = r1057531 <= r1057532;
        double r1057534 = x;
        double r1057535 = y;
        double r1057536 = z;
        double r1057537 = r1057535 * r1057536;
        double r1057538 = t;
        double r1057539 = a;
        double r1057540 = r1057538 * r1057539;
        double r1057541 = r1057537 - r1057540;
        double r1057542 = r1057534 * r1057541;
        double r1057543 = b;
        double r1057544 = c;
        double r1057545 = r1057543 * r1057544;
        double r1057546 = r1057536 * r1057545;
        double r1057547 = -1.0;
        double r1057548 = i;
        double r1057549 = r1057548 * r1057543;
        double r1057550 = r1057538 * r1057549;
        double r1057551 = r1057547 * r1057550;
        double r1057552 = 1.0;
        double r1057553 = pow(r1057551, r1057552);
        double r1057554 = r1057546 + r1057553;
        double r1057555 = r1057542 - r1057554;
        double r1057556 = r1057544 * r1057539;
        double r1057557 = r1057535 * r1057548;
        double r1057558 = r1057556 - r1057557;
        double r1057559 = r1057531 * r1057558;
        double r1057560 = r1057555 + r1057559;
        double r1057561 = r1057536 * r1057543;
        double r1057562 = r1057561 * r1057544;
        double r1057563 = -r1057543;
        double r1057564 = r1057563 * r1057538;
        double r1057565 = r1057564 * r1057548;
        double r1057566 = r1057562 + r1057565;
        double r1057567 = r1057542 - r1057566;
        double r1057568 = r1057567 + r1057559;
        double r1057569 = r1057533 ? r1057560 : r1057568;
        return r1057569;
}

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

Original12.4
Target20.4
Herbie12.5
\[\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 j < -1.2972310261003198e-34

    1. Initial program 8.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 add-cube-cbrt9.0

      \[\leadsto \left(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) + j \cdot \left(c \cdot a - y \cdot i\right)\]
    4. Applied associate-*l*9.0

      \[\leadsto \left(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) + j \cdot \left(c \cdot a - y \cdot i\right)\]
    5. Using strategy rm
    6. Applied sub-neg9.0

      \[\leadsto \left(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) + j \cdot \left(c \cdot a - y \cdot i\right)\]
    7. Applied distribute-lft-in8.9

      \[\leadsto \left(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) + j \cdot \left(c \cdot a - y \cdot i\right)\]
    8. Applied distribute-lft-in8.9

      \[\leadsto \left(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) + j \cdot \left(c \cdot a - y \cdot i\right)\]
    9. Simplified9.4

      \[\leadsto \left(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) + j \cdot \left(c \cdot a - y \cdot i\right)\]
    10. Simplified9.3

      \[\leadsto \left(x \cdot \left(y \cdot z - t \cdot a\right) - \left(z \cdot \left(b \cdot c\right) + \color{blue}{\left(-b\right) \cdot \left(t \cdot i\right)}\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\]
    11. Using strategy rm
    12. Applied pow19.3

      \[\leadsto \left(x \cdot \left(y \cdot z - t \cdot a\right) - \left(z \cdot \left(b \cdot c\right) + \left(-b\right) \cdot \left(t \cdot \color{blue}{{i}^{1}}\right)\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\]
    13. Applied pow19.3

      \[\leadsto \left(x \cdot \left(y \cdot z - t \cdot a\right) - \left(z \cdot \left(b \cdot c\right) + \left(-b\right) \cdot \left(\color{blue}{{t}^{1}} \cdot {i}^{1}\right)\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\]
    14. Applied pow-prod-down9.3

      \[\leadsto \left(x \cdot \left(y \cdot z - t \cdot a\right) - \left(z \cdot \left(b \cdot c\right) + \left(-b\right) \cdot \color{blue}{{\left(t \cdot i\right)}^{1}}\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\]
    15. Applied pow19.3

      \[\leadsto \left(x \cdot \left(y \cdot z - t \cdot a\right) - \left(z \cdot \left(b \cdot c\right) + \color{blue}{{\left(-b\right)}^{1}} \cdot {\left(t \cdot i\right)}^{1}\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\]
    16. Applied pow-prod-down9.3

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

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

    if -1.2972310261003198e-34 < j

    1. Initial program 13.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. Using strategy rm
    3. Applied add-cube-cbrt13.8

      \[\leadsto \left(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) + j \cdot \left(c \cdot a - y \cdot i\right)\]
    4. Applied associate-*l*13.8

      \[\leadsto \left(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) + j \cdot \left(c \cdot a - y \cdot i\right)\]
    5. Using strategy rm
    6. Applied sub-neg13.8

      \[\leadsto \left(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) + j \cdot \left(c \cdot a - y \cdot i\right)\]
    7. Applied distribute-lft-in13.8

      \[\leadsto \left(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) + j \cdot \left(c \cdot a - y \cdot i\right)\]
    8. Applied distribute-lft-in13.8

      \[\leadsto \left(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) + j \cdot \left(c \cdot a - y \cdot i\right)\]
    9. Simplified14.2

      \[\leadsto \left(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) + j \cdot \left(c \cdot a - y \cdot i\right)\]
    10. Simplified14.0

      \[\leadsto \left(x \cdot \left(y \cdot z - t \cdot a\right) - \left(z \cdot \left(b \cdot c\right) + \color{blue}{\left(-b\right) \cdot \left(t \cdot i\right)}\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\]
    11. Using strategy rm
    12. Applied associate-*r*13.7

      \[\leadsto \left(x \cdot \left(y \cdot z - t \cdot a\right) - \left(z \cdot \left(b \cdot c\right) + \color{blue}{\left(\left(-b\right) \cdot t\right) \cdot i}\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\]
    13. Using strategy rm
    14. Applied associate-*r*13.6

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

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

Reproduce

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