Average Error: 11.7 → 12.6
Time: 33.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)\]
\[\mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, t \cdot i - c \cdot z, \left(\sqrt[3]{\left(j \cdot c\right) \cdot a} \cdot \sqrt[3]{\left(j \cdot c\right) \cdot a}\right) \cdot \sqrt[3]{\left(j \cdot c\right) \cdot a} + \left(-y\right) \cdot \left(i \cdot j\right)\right)\right)\]
\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)
\mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, t \cdot i - c \cdot z, \left(\sqrt[3]{\left(j \cdot c\right) \cdot a} \cdot \sqrt[3]{\left(j \cdot c\right) \cdot a}\right) \cdot \sqrt[3]{\left(j \cdot c\right) \cdot a} + \left(-y\right) \cdot \left(i \cdot j\right)\right)\right)
double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r678322 = x;
        double r678323 = y;
        double r678324 = z;
        double r678325 = r678323 * r678324;
        double r678326 = t;
        double r678327 = a;
        double r678328 = r678326 * r678327;
        double r678329 = r678325 - r678328;
        double r678330 = r678322 * r678329;
        double r678331 = b;
        double r678332 = c;
        double r678333 = r678332 * r678324;
        double r678334 = i;
        double r678335 = r678326 * r678334;
        double r678336 = r678333 - r678335;
        double r678337 = r678331 * r678336;
        double r678338 = r678330 - r678337;
        double r678339 = j;
        double r678340 = r678332 * r678327;
        double r678341 = r678323 * r678334;
        double r678342 = r678340 - r678341;
        double r678343 = r678339 * r678342;
        double r678344 = r678338 + r678343;
        return r678344;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r678345 = x;
        double r678346 = y;
        double r678347 = z;
        double r678348 = r678346 * r678347;
        double r678349 = t;
        double r678350 = a;
        double r678351 = r678349 * r678350;
        double r678352 = r678348 - r678351;
        double r678353 = b;
        double r678354 = i;
        double r678355 = r678349 * r678354;
        double r678356 = c;
        double r678357 = r678356 * r678347;
        double r678358 = r678355 - r678357;
        double r678359 = j;
        double r678360 = r678359 * r678356;
        double r678361 = r678360 * r678350;
        double r678362 = cbrt(r678361);
        double r678363 = r678362 * r678362;
        double r678364 = r678363 * r678362;
        double r678365 = -r678346;
        double r678366 = r678354 * r678359;
        double r678367 = r678365 * r678366;
        double r678368 = r678364 + r678367;
        double r678369 = fma(r678353, r678358, r678368);
        double r678370 = fma(r678345, r678352, r678369);
        return r678370;
}

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.7
Target19.5
Herbie12.6
\[\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. Initial program 11.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. Simplified11.7

    \[\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 sub-neg11.7

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

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

    \[\leadsto \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\right) + \color{blue}{\left(-y \cdot i\right) \cdot j}\right)\right)\]
  7. Using strategy rm
  8. Applied distribute-lft-neg-in11.7

    \[\leadsto \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\right) + \color{blue}{\left(\left(-y\right) \cdot i\right)} \cdot j\right)\right)\]
  9. Applied associate-*l*12.3

    \[\leadsto \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\right) + \color{blue}{\left(-y\right) \cdot \left(i \cdot j\right)}\right)\right)\]
  10. Using strategy rm
  11. Applied associate-*r*12.5

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

    \[\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]{\left(j \cdot c\right) \cdot a} \cdot \sqrt[3]{\left(j \cdot c\right) \cdot a}\right) \cdot \sqrt[3]{\left(j \cdot c\right) \cdot a}} + \left(-y\right) \cdot \left(i \cdot j\right)\right)\right)\]
  14. Final simplification12.6

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

Reproduce

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