Average Error: 5.8 → 1.9
Time: 24.9s
Precision: 64
\[2.0 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)\]
\[2.0 \cdot \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left(c \cdot i\right) \cdot \mathsf{fma}\left(b, c, a\right)\right)\]
2.0 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)
2.0 \cdot \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left(c \cdot i\right) \cdot \mathsf{fma}\left(b, c, a\right)\right)
double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r31593559 = 2.0;
        double r31593560 = x;
        double r31593561 = y;
        double r31593562 = r31593560 * r31593561;
        double r31593563 = z;
        double r31593564 = t;
        double r31593565 = r31593563 * r31593564;
        double r31593566 = r31593562 + r31593565;
        double r31593567 = a;
        double r31593568 = b;
        double r31593569 = c;
        double r31593570 = r31593568 * r31593569;
        double r31593571 = r31593567 + r31593570;
        double r31593572 = r31593571 * r31593569;
        double r31593573 = i;
        double r31593574 = r31593572 * r31593573;
        double r31593575 = r31593566 - r31593574;
        double r31593576 = r31593559 * r31593575;
        return r31593576;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r31593577 = 2.0;
        double r31593578 = t;
        double r31593579 = z;
        double r31593580 = y;
        double r31593581 = x;
        double r31593582 = r31593580 * r31593581;
        double r31593583 = fma(r31593578, r31593579, r31593582);
        double r31593584 = c;
        double r31593585 = i;
        double r31593586 = r31593584 * r31593585;
        double r31593587 = b;
        double r31593588 = a;
        double r31593589 = fma(r31593587, r31593584, r31593588);
        double r31593590 = r31593586 * r31593589;
        double r31593591 = r31593583 - r31593590;
        double r31593592 = r31593577 * r31593591;
        return r31593592;
}

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

Original5.8
Target1.9
Herbie1.9
\[2.0 \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 5.8

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

    \[\leadsto \color{blue}{2.0 \cdot \left(\mathsf{fma}\left(t, z, y \cdot x\right) - i \cdot \left(\mathsf{fma}\left(b, c, a\right) \cdot c\right)\right)}\]
  3. Using strategy rm
  4. Applied associate-*r*5.5

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

herbie shell --seed 2019163 +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"

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

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