Average Error: 6.3 → 1.6
Time: 20.1s
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 r732229 = 2.0;
        double r732230 = x;
        double r732231 = y;
        double r732232 = r732230 * r732231;
        double r732233 = z;
        double r732234 = t;
        double r732235 = r732233 * r732234;
        double r732236 = r732232 + r732235;
        double r732237 = a;
        double r732238 = b;
        double r732239 = c;
        double r732240 = r732238 * r732239;
        double r732241 = r732237 + r732240;
        double r732242 = r732241 * r732239;
        double r732243 = i;
        double r732244 = r732242 * r732243;
        double r732245 = r732236 - r732244;
        double r732246 = r732229 * r732245;
        return r732246;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r732247 = 2.0;
        double r732248 = y;
        double r732249 = x;
        double r732250 = t;
        double r732251 = z;
        double r732252 = c;
        double r732253 = b;
        double r732254 = a;
        double r732255 = fma(r732252, r732253, r732254);
        double r732256 = -r732255;
        double r732257 = i;
        double r732258 = r732252 * r732257;
        double r732259 = r732256 * r732258;
        double r732260 = fma(r732250, r732251, r732259);
        double r732261 = fma(r732248, r732249, r732260);
        double r732262 = r732247 * r732261;
        return r732262;
}

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

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

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

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