Average Error: 5.9 → 1.7
Time: 25.1s
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 r28789509 = 2.0;
        double r28789510 = x;
        double r28789511 = y;
        double r28789512 = r28789510 * r28789511;
        double r28789513 = z;
        double r28789514 = t;
        double r28789515 = r28789513 * r28789514;
        double r28789516 = r28789512 + r28789515;
        double r28789517 = a;
        double r28789518 = b;
        double r28789519 = c;
        double r28789520 = r28789518 * r28789519;
        double r28789521 = r28789517 + r28789520;
        double r28789522 = r28789521 * r28789519;
        double r28789523 = i;
        double r28789524 = r28789522 * r28789523;
        double r28789525 = r28789516 - r28789524;
        double r28789526 = r28789509 * r28789525;
        return r28789526;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r28789527 = 2.0;
        double r28789528 = t;
        double r28789529 = z;
        double r28789530 = y;
        double r28789531 = x;
        double r28789532 = r28789530 * r28789531;
        double r28789533 = fma(r28789528, r28789529, r28789532);
        double r28789534 = c;
        double r28789535 = i;
        double r28789536 = r28789534 * r28789535;
        double r28789537 = b;
        double r28789538 = a;
        double r28789539 = fma(r28789537, r28789534, r28789538);
        double r28789540 = r28789536 * r28789539;
        double r28789541 = r28789533 - r28789540;
        double r28789542 = r28789527 * r28789541;
        return r28789542;
}

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.9
Target1.7
Herbie1.7
\[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.9

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

    \[\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*4.9

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\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 2019158 +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))))