Average Error: 12.1 → 9.1
Time: 11.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}\;b \le -11835698871508040:\\ \;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, j, \left(x \cdot \left(\left(\left(\sqrt[3]{\sqrt[3]{y \cdot z - t \cdot a}} \cdot \sqrt[3]{\sqrt[3]{y \cdot z - t \cdot a}}\right) \cdot \sqrt[3]{\sqrt[3]{y \cdot z - t \cdot a}}\right) \cdot \sqrt[3]{y \cdot z - t \cdot a}\right)\right) \cdot \sqrt[3]{y \cdot z - t \cdot a} - b \cdot \left(c \cdot z - t \cdot i\right)\right)\\ \mathbf{elif}\;b \le 5.2025741819253724 \cdot 10^{79}:\\ \;\;\;\;\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) - t \cdot \left(i \cdot b\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, j, x \cdot \left(y \cdot z - t \cdot a\right) - \sqrt{b} \cdot \left(\sqrt{b} \cdot \left(c \cdot z - t \cdot i\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 -11835698871508040:\\
\;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, j, \left(x \cdot \left(\left(\left(\sqrt[3]{\sqrt[3]{y \cdot z - t \cdot a}} \cdot \sqrt[3]{\sqrt[3]{y \cdot z - t \cdot a}}\right) \cdot \sqrt[3]{\sqrt[3]{y \cdot z - t \cdot a}}\right) \cdot \sqrt[3]{y \cdot z - t \cdot a}\right)\right) \cdot \sqrt[3]{y \cdot z - t \cdot a} - b \cdot \left(c \cdot z - t \cdot i\right)\right)\\

\mathbf{elif}\;b \le 5.2025741819253724 \cdot 10^{79}:\\
\;\;\;\;\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) - t \cdot \left(i \cdot b\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, j, x \cdot \left(y \cdot z - t \cdot a\right) - \sqrt{b} \cdot \left(\sqrt{b} \cdot \left(c \cdot z - t \cdot i\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 r856278 = x;
        double r856279 = y;
        double r856280 = z;
        double r856281 = r856279 * r856280;
        double r856282 = t;
        double r856283 = a;
        double r856284 = r856282 * r856283;
        double r856285 = r856281 - r856284;
        double r856286 = r856278 * r856285;
        double r856287 = b;
        double r856288 = c;
        double r856289 = r856288 * r856280;
        double r856290 = i;
        double r856291 = r856282 * r856290;
        double r856292 = r856289 - r856291;
        double r856293 = r856287 * r856292;
        double r856294 = r856286 - r856293;
        double r856295 = j;
        double r856296 = r856288 * r856283;
        double r856297 = r856279 * r856290;
        double r856298 = r856296 - r856297;
        double r856299 = r856295 * r856298;
        double r856300 = r856294 + r856299;
        return r856300;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r856301 = b;
        double r856302 = -1.183569887150804e+16;
        bool r856303 = r856301 <= r856302;
        double r856304 = c;
        double r856305 = a;
        double r856306 = r856304 * r856305;
        double r856307 = y;
        double r856308 = i;
        double r856309 = r856307 * r856308;
        double r856310 = r856306 - r856309;
        double r856311 = j;
        double r856312 = x;
        double r856313 = z;
        double r856314 = r856307 * r856313;
        double r856315 = t;
        double r856316 = r856315 * r856305;
        double r856317 = r856314 - r856316;
        double r856318 = cbrt(r856317);
        double r856319 = cbrt(r856318);
        double r856320 = r856319 * r856319;
        double r856321 = r856320 * r856319;
        double r856322 = r856321 * r856318;
        double r856323 = r856312 * r856322;
        double r856324 = r856323 * r856318;
        double r856325 = r856304 * r856313;
        double r856326 = r856315 * r856308;
        double r856327 = r856325 - r856326;
        double r856328 = r856301 * r856327;
        double r856329 = r856324 - r856328;
        double r856330 = fma(r856310, r856311, r856329);
        double r856331 = 5.2025741819253724e+79;
        bool r856332 = r856301 <= r856331;
        double r856333 = r856312 * r856317;
        double r856334 = r856301 * r856304;
        double r856335 = r856313 * r856334;
        double r856336 = r856308 * r856301;
        double r856337 = r856315 * r856336;
        double r856338 = r856335 - r856337;
        double r856339 = r856333 - r856338;
        double r856340 = fma(r856310, r856311, r856339);
        double r856341 = sqrt(r856301);
        double r856342 = r856341 * r856327;
        double r856343 = r856341 * r856342;
        double r856344 = r856333 - r856343;
        double r856345 = fma(r856310, r856311, r856344);
        double r856346 = r856332 ? r856340 : r856345;
        double r856347 = r856303 ? r856330 : r856346;
        return r856347;
}

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.1
Target20.5
Herbie9.1
\[\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 < -1.183569887150804e+16

    1. Initial program 6.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. Simplified6.3

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

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

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

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

    if -1.183569887150804e+16 < b < 5.2025741819253724e+79

    1. Initial program 14.7

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

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

      \[\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 add-cube-cbrt14.9

      \[\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]{\color{blue}{\left(\sqrt[3]{b} \cdot \sqrt[3]{b}\right) \cdot \sqrt[3]{b}}} \cdot \left(c \cdot z - t \cdot i\right)\right)\right)\]
    8. Applied cbrt-prod14.9

      \[\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(\color{blue}{\left(\sqrt[3]{\sqrt[3]{b} \cdot \sqrt[3]{b}} \cdot \sqrt[3]{\sqrt[3]{b}}\right)} \cdot \left(c \cdot z - t \cdot i\right)\right)\right)\]
    9. Applied associate-*l*14.9

      \[\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]{\sqrt[3]{b} \cdot \sqrt[3]{b}} \cdot \left(\sqrt[3]{\sqrt[3]{b}} \cdot \left(c \cdot z - t \cdot i\right)\right)\right)}\right)\]
    10. Taylor expanded around inf 10.2

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

    if 5.2025741819253724e+79 < 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.6

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

      \[\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{b} \cdot \sqrt{b}\right)} \cdot \left(c \cdot z - t \cdot i\right)\right)\]
    5. Applied associate-*l*6.8

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -11835698871508040:\\ \;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, j, \left(x \cdot \left(\left(\left(\sqrt[3]{\sqrt[3]{y \cdot z - t \cdot a}} \cdot \sqrt[3]{\sqrt[3]{y \cdot z - t \cdot a}}\right) \cdot \sqrt[3]{\sqrt[3]{y \cdot z - t \cdot a}}\right) \cdot \sqrt[3]{y \cdot z - t \cdot a}\right)\right) \cdot \sqrt[3]{y \cdot z - t \cdot a} - b \cdot \left(c \cdot z - t \cdot i\right)\right)\\ \mathbf{elif}\;b \le 5.2025741819253724 \cdot 10^{79}:\\ \;\;\;\;\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) - t \cdot \left(i \cdot b\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, j, x \cdot \left(y \cdot z - t \cdot a\right) - \sqrt{b} \cdot \left(\sqrt{b} \cdot \left(c \cdot z - t \cdot i\right)\right)\right)\\ \end{array}\]

Reproduce

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