Average Error: 6.7 → 2.1
Time: 8.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 r714107 = 2.0;
        double r714108 = x;
        double r714109 = y;
        double r714110 = r714108 * r714109;
        double r714111 = z;
        double r714112 = t;
        double r714113 = r714111 * r714112;
        double r714114 = r714110 + r714113;
        double r714115 = a;
        double r714116 = b;
        double r714117 = c;
        double r714118 = r714116 * r714117;
        double r714119 = r714115 + r714118;
        double r714120 = r714119 * r714117;
        double r714121 = i;
        double r714122 = r714120 * r714121;
        double r714123 = r714114 - r714122;
        double r714124 = r714107 * r714123;
        return r714124;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r714125 = 2.0;
        double r714126 = x;
        double r714127 = y;
        double r714128 = z;
        double r714129 = t;
        double r714130 = r714128 * r714129;
        double r714131 = fma(r714126, r714127, r714130);
        double r714132 = c;
        double r714133 = b;
        double r714134 = a;
        double r714135 = fma(r714132, r714133, r714134);
        double r714136 = -r714135;
        double r714137 = i;
        double r714138 = r714132 * r714137;
        double r714139 = r714136 * r714138;
        double r714140 = r714125 * r714139;
        double r714141 = fma(r714125, r714131, r714140);
        return r714141;
}

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

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

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

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