Average Error: 6.3 → 1.6
Time: 23.0s
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 r780190 = 2.0;
        double r780191 = x;
        double r780192 = y;
        double r780193 = r780191 * r780192;
        double r780194 = z;
        double r780195 = t;
        double r780196 = r780194 * r780195;
        double r780197 = r780193 + r780196;
        double r780198 = a;
        double r780199 = b;
        double r780200 = c;
        double r780201 = r780199 * r780200;
        double r780202 = r780198 + r780201;
        double r780203 = r780202 * r780200;
        double r780204 = i;
        double r780205 = r780203 * r780204;
        double r780206 = r780197 - r780205;
        double r780207 = r780190 * r780206;
        return r780207;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r780208 = 2.0;
        double r780209 = y;
        double r780210 = x;
        double r780211 = t;
        double r780212 = z;
        double r780213 = c;
        double r780214 = b;
        double r780215 = a;
        double r780216 = fma(r780213, r780214, r780215);
        double r780217 = -r780216;
        double r780218 = i;
        double r780219 = r780213 * r780218;
        double r780220 = r780217 * r780219;
        double r780221 = fma(r780211, r780212, r780220);
        double r780222 = fma(r780209, r780210, r780221);
        double r780223 = r780208 * r780222;
        return r780223;
}

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))))