Average Error: 6.1 → 1.8
Time: 26.1s
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 \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 \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 \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 r30088754 = 2.0;
        double r30088755 = x;
        double r30088756 = y;
        double r30088757 = r30088755 * r30088756;
        double r30088758 = z;
        double r30088759 = t;
        double r30088760 = r30088758 * r30088759;
        double r30088761 = r30088757 + r30088760;
        double r30088762 = a;
        double r30088763 = b;
        double r30088764 = c;
        double r30088765 = r30088763 * r30088764;
        double r30088766 = r30088762 + r30088765;
        double r30088767 = r30088766 * r30088764;
        double r30088768 = i;
        double r30088769 = r30088767 * r30088768;
        double r30088770 = r30088761 - r30088769;
        double r30088771 = r30088754 * r30088770;
        return r30088771;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r30088772 = 2.0;
        double r30088773 = t;
        double r30088774 = z;
        double r30088775 = y;
        double r30088776 = x;
        double r30088777 = r30088775 * r30088776;
        double r30088778 = fma(r30088773, r30088774, r30088777);
        double r30088779 = c;
        double r30088780 = i;
        double r30088781 = r30088779 * r30088780;
        double r30088782 = b;
        double r30088783 = a;
        double r30088784 = fma(r30088782, r30088779, r30088783);
        double r30088785 = r30088781 * r30088784;
        double r30088786 = r30088778 - r30088785;
        double r30088787 = r30088772 * r30088786;
        return r30088787;
}

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.1
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.1

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

    \[\leadsto \color{blue}{2 \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.9

    \[\leadsto 2 \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-cbrt6.2

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto 2 \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.8

    \[\leadsto 2 \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 2019179 +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))))