Average Error: 6.3 → 1.8
Time: 33.3s
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(c \cdot i\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(c \cdot i\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 r450690 = 2.0;
        double r450691 = x;
        double r450692 = y;
        double r450693 = r450691 * r450692;
        double r450694 = z;
        double r450695 = t;
        double r450696 = r450694 * r450695;
        double r450697 = r450693 + r450696;
        double r450698 = a;
        double r450699 = b;
        double r450700 = c;
        double r450701 = r450699 * r450700;
        double r450702 = r450698 + r450701;
        double r450703 = r450702 * r450700;
        double r450704 = i;
        double r450705 = r450703 * r450704;
        double r450706 = r450697 - r450705;
        double r450707 = r450690 * r450706;
        return r450707;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r450708 = 2.0;
        double r450709 = y;
        double r450710 = x;
        double r450711 = z;
        double r450712 = t;
        double r450713 = r450711 * r450712;
        double r450714 = c;
        double r450715 = i;
        double r450716 = r450714 * r450715;
        double r450717 = b;
        double r450718 = a;
        double r450719 = fma(r450714, r450717, r450718);
        double r450720 = r450716 * r450719;
        double r450721 = r450713 - r450720;
        double r450722 = fma(r450709, r450710, r450721);
        double r450723 = r450708 * r450722;
        return r450723;
}

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 associate-*l*5.1

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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