Average Error: 6.5 → 1.8
Time: 9.8s
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)\]
\[\mathsf{fma}\left(2, \mathsf{fma}\left(x, y, z \cdot t\right), 2 \cdot \left(\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)\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)
\mathsf{fma}\left(2, \mathsf{fma}\left(x, y, z \cdot t\right), 2 \cdot \left(\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)\right)\right)
double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r715677 = 2.0;
        double r715678 = x;
        double r715679 = y;
        double r715680 = r715678 * r715679;
        double r715681 = z;
        double r715682 = t;
        double r715683 = r715681 * r715682;
        double r715684 = r715680 + r715683;
        double r715685 = a;
        double r715686 = b;
        double r715687 = c;
        double r715688 = r715686 * r715687;
        double r715689 = r715685 + r715688;
        double r715690 = r715689 * r715687;
        double r715691 = i;
        double r715692 = r715690 * r715691;
        double r715693 = r715684 - r715692;
        double r715694 = r715677 * r715693;
        return r715694;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r715695 = 2.0;
        double r715696 = x;
        double r715697 = y;
        double r715698 = z;
        double r715699 = t;
        double r715700 = r715698 * r715699;
        double r715701 = fma(r715696, r715697, r715700);
        double r715702 = c;
        double r715703 = b;
        double r715704 = a;
        double r715705 = fma(r715702, r715703, r715704);
        double r715706 = -r715705;
        double r715707 = i;
        double r715708 = r715702 * r715707;
        double r715709 = r715706 * r715708;
        double r715710 = r715695 * r715709;
        double r715711 = fma(r715695, r715701, r715710);
        return r715711;
}

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

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

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

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

Reproduce

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