Average Error: 6.1 → 1.8
Time: 20.5s
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, \mathsf{fma}\left(t, z, \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)
2 \cdot \mathsf{fma}\left(y, x, \mathsf{fma}\left(t, z, \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 r726751 = 2.0;
        double r726752 = x;
        double r726753 = y;
        double r726754 = r726752 * r726753;
        double r726755 = z;
        double r726756 = t;
        double r726757 = r726755 * r726756;
        double r726758 = r726754 + r726757;
        double r726759 = a;
        double r726760 = b;
        double r726761 = c;
        double r726762 = r726760 * r726761;
        double r726763 = r726759 + r726762;
        double r726764 = r726763 * r726761;
        double r726765 = i;
        double r726766 = r726764 * r726765;
        double r726767 = r726758 - r726766;
        double r726768 = r726751 * r726767;
        return r726768;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r726769 = 2.0;
        double r726770 = y;
        double r726771 = x;
        double r726772 = t;
        double r726773 = z;
        double r726774 = c;
        double r726775 = b;
        double r726776 = a;
        double r726777 = fma(r726774, r726775, r726776);
        double r726778 = -r726777;
        double r726779 = i;
        double r726780 = r726774 * r726779;
        double r726781 = r726778 * r726780;
        double r726782 = fma(r726772, r726773, r726781);
        double r726783 = fma(r726770, r726771, r726782);
        double r726784 = r726769 * r726783;
        return r726784;
}

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

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

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

Reproduce

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