Average Error: 6.2 → 2.1
Time: 32.4s
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(y, x, t \cdot z\right) - \left(\sqrt[3]{\left(i \cdot c\right) \cdot \mathsf{fma}\left(c, b, a\right)} \cdot \sqrt[3]{\left(i \cdot c\right) \cdot \mathsf{fma}\left(c, b, a\right)}\right) \cdot \sqrt[3]{\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 \left(\mathsf{fma}\left(y, x, t \cdot z\right) - \left(\sqrt[3]{\left(i \cdot c\right) \cdot \mathsf{fma}\left(c, b, a\right)} \cdot \sqrt[3]{\left(i \cdot c\right) \cdot \mathsf{fma}\left(c, b, a\right)}\right) \cdot \sqrt[3]{\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 r29833759 = 2.0;
        double r29833760 = x;
        double r29833761 = y;
        double r29833762 = r29833760 * r29833761;
        double r29833763 = z;
        double r29833764 = t;
        double r29833765 = r29833763 * r29833764;
        double r29833766 = r29833762 + r29833765;
        double r29833767 = a;
        double r29833768 = b;
        double r29833769 = c;
        double r29833770 = r29833768 * r29833769;
        double r29833771 = r29833767 + r29833770;
        double r29833772 = r29833771 * r29833769;
        double r29833773 = i;
        double r29833774 = r29833772 * r29833773;
        double r29833775 = r29833766 - r29833774;
        double r29833776 = r29833759 * r29833775;
        return r29833776;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r29833777 = 2.0;
        double r29833778 = y;
        double r29833779 = x;
        double r29833780 = t;
        double r29833781 = z;
        double r29833782 = r29833780 * r29833781;
        double r29833783 = fma(r29833778, r29833779, r29833782);
        double r29833784 = i;
        double r29833785 = c;
        double r29833786 = r29833784 * r29833785;
        double r29833787 = b;
        double r29833788 = a;
        double r29833789 = fma(r29833785, r29833787, r29833788);
        double r29833790 = r29833786 * r29833789;
        double r29833791 = cbrt(r29833790);
        double r29833792 = r29833791 * r29833791;
        double r29833793 = r29833792 * r29833791;
        double r29833794 = r29833783 - r29833793;
        double r29833795 = r29833777 * r29833794;
        return r29833795;
}

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.2
Target1.8
Herbie2.1
\[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.2

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

    \[\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. Taylor expanded around inf 9.0

    \[\leadsto 2 \cdot \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \color{blue}{\left(i \cdot \left(b \cdot {c}^{2}\right) + a \cdot \left(i \cdot c\right)\right)}\right)\]
  4. Simplified5.4

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

    \[\leadsto 2 \cdot \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \color{blue}{\mathsf{fma}\left(c, b, a\right) \cdot \left(i \cdot c\right)}\right)\]
  7. Taylor expanded around inf 1.8

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

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

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

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

Reproduce

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