Average Error: 6.3 → 1.8
Time: 38.9s
Precision: 64
\[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)\]
\[2 \cdot \mathsf{fma}\left(y, x, z \cdot t - \left(i \cdot c\right) \cdot \mathsf{fma}\left(c, b, a\right)\right)\]
2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)
2 \cdot \mathsf{fma}\left(y, x, z \cdot t - \left(i \cdot c\right) \cdot \mathsf{fma}\left(c, b, a\right)\right)
double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r497445 = 2.0;
        double r497446 = x;
        double r497447 = y;
        double r497448 = r497446 * r497447;
        double r497449 = z;
        double r497450 = t;
        double r497451 = r497449 * r497450;
        double r497452 = r497448 + r497451;
        double r497453 = a;
        double r497454 = b;
        double r497455 = c;
        double r497456 = r497454 * r497455;
        double r497457 = r497453 + r497456;
        double r497458 = r497457 * r497455;
        double r497459 = i;
        double r497460 = r497458 * r497459;
        double r497461 = r497452 - r497460;
        double r497462 = r497445 * r497461;
        return r497462;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r497463 = 2.0;
        double r497464 = y;
        double r497465 = x;
        double r497466 = z;
        double r497467 = t;
        double r497468 = r497466 * r497467;
        double r497469 = i;
        double r497470 = c;
        double r497471 = r497469 * r497470;
        double r497472 = b;
        double r497473 = a;
        double r497474 = fma(r497470, r497472, r497473);
        double r497475 = r497471 * r497474;
        double r497476 = r497468 - r497475;
        double r497477 = fma(r497464, r497465, r497476);
        double r497478 = r497463 * r497477;
        return r497478;
}

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

Target

Original6.3
Target1.8
Herbie1.8
\[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(a + b \cdot c\right) \cdot \left(c \cdot i\right)\right)\]

Derivation

  1. Initial program 6.3

    \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)\]
  2. Simplified6.3

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

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

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

    \[\leadsto 2 \cdot \mathsf{fma}\left(y, x, z \cdot t - \left(\left(c \cdot \left(\sqrt[3]{\mathsf{fma}\left(c, b, a\right)} \cdot \sqrt[3]{\mathsf{fma}\left(c, b, a\right)}\right)\right) \cdot \sqrt[3]{\mathsf{fma}\left(c, b, a\right)}\right) \cdot \color{blue}{{i}^{1}}\right)\]
  8. Applied pow16.6

    \[\leadsto 2 \cdot \mathsf{fma}\left(y, x, z \cdot t - \left(\left(c \cdot \left(\sqrt[3]{\mathsf{fma}\left(c, b, a\right)} \cdot \sqrt[3]{\mathsf{fma}\left(c, b, a\right)}\right)\right) \cdot \color{blue}{{\left(\sqrt[3]{\mathsf{fma}\left(c, b, a\right)}\right)}^{1}}\right) \cdot {i}^{1}\right)\]
  9. Applied pow16.6

    \[\leadsto 2 \cdot \mathsf{fma}\left(y, x, z \cdot t - \left(\left(c \cdot \left(\sqrt[3]{\mathsf{fma}\left(c, b, a\right)} \cdot \color{blue}{{\left(\sqrt[3]{\mathsf{fma}\left(c, b, a\right)}\right)}^{1}}\right)\right) \cdot {\left(\sqrt[3]{\mathsf{fma}\left(c, b, a\right)}\right)}^{1}\right) \cdot {i}^{1}\right)\]
  10. Applied pow16.6

    \[\leadsto 2 \cdot \mathsf{fma}\left(y, x, z \cdot t - \left(\left(c \cdot \left(\color{blue}{{\left(\sqrt[3]{\mathsf{fma}\left(c, b, a\right)}\right)}^{1}} \cdot {\left(\sqrt[3]{\mathsf{fma}\left(c, b, a\right)}\right)}^{1}\right)\right) \cdot {\left(\sqrt[3]{\mathsf{fma}\left(c, b, a\right)}\right)}^{1}\right) \cdot {i}^{1}\right)\]
  11. Applied pow-prod-down6.6

    \[\leadsto 2 \cdot \mathsf{fma}\left(y, x, z \cdot t - \left(\left(c \cdot \color{blue}{{\left(\sqrt[3]{\mathsf{fma}\left(c, b, a\right)} \cdot \sqrt[3]{\mathsf{fma}\left(c, b, a\right)}\right)}^{1}}\right) \cdot {\left(\sqrt[3]{\mathsf{fma}\left(c, b, a\right)}\right)}^{1}\right) \cdot {i}^{1}\right)\]
  12. Applied pow16.6

    \[\leadsto 2 \cdot \mathsf{fma}\left(y, x, z \cdot t - \left(\left(\color{blue}{{c}^{1}} \cdot {\left(\sqrt[3]{\mathsf{fma}\left(c, b, a\right)} \cdot \sqrt[3]{\mathsf{fma}\left(c, b, a\right)}\right)}^{1}\right) \cdot {\left(\sqrt[3]{\mathsf{fma}\left(c, b, a\right)}\right)}^{1}\right) \cdot {i}^{1}\right)\]
  13. Applied pow-prod-down6.6

    \[\leadsto 2 \cdot \mathsf{fma}\left(y, x, z \cdot t - \left(\color{blue}{{\left(c \cdot \left(\sqrt[3]{\mathsf{fma}\left(c, b, a\right)} \cdot \sqrt[3]{\mathsf{fma}\left(c, b, a\right)}\right)\right)}^{1}} \cdot {\left(\sqrt[3]{\mathsf{fma}\left(c, b, a\right)}\right)}^{1}\right) \cdot {i}^{1}\right)\]
  14. Applied pow-prod-down6.6

    \[\leadsto 2 \cdot \mathsf{fma}\left(y, x, z \cdot t - \color{blue}{{\left(\left(c \cdot \left(\sqrt[3]{\mathsf{fma}\left(c, b, a\right)} \cdot \sqrt[3]{\mathsf{fma}\left(c, b, a\right)}\right)\right) \cdot \sqrt[3]{\mathsf{fma}\left(c, b, a\right)}\right)}^{1}} \cdot {i}^{1}\right)\]
  15. Applied pow-prod-down6.6

    \[\leadsto 2 \cdot \mathsf{fma}\left(y, x, z \cdot t - \color{blue}{{\left(\left(\left(c \cdot \left(\sqrt[3]{\mathsf{fma}\left(c, b, a\right)} \cdot \sqrt[3]{\mathsf{fma}\left(c, b, a\right)}\right)\right) \cdot \sqrt[3]{\mathsf{fma}\left(c, b, a\right)}\right) \cdot i\right)}^{1}}\right)\]
  16. Simplified1.8

    \[\leadsto 2 \cdot \mathsf{fma}\left(y, x, z \cdot t - {\color{blue}{\left(\left(i \cdot c\right) \cdot \mathsf{fma}\left(c, b, a\right)\right)}}^{1}\right)\]
  17. Final simplification1.8

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

Reproduce

herbie shell --seed 2019325 +o rules:numerics
(FPCore (x y z t a b c i)
  :name "Diagrams.ThreeD.Shapes:frustum from diagrams-lib-1.3.0.3, A"
  :precision binary64

  :herbie-target
  (* 2 (- (+ (* x y) (* z t)) (* (+ a (* b c)) (* c i))))

  (* 2 (- (+ (* x y) (* z t)) (* (* (+ a (* b c)) c) i))))