Average Error: 6.1 → 1.5
Time: 34.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)\]
\[2 \cdot \mathsf{fma}\left(y, x, \mathsf{fma}\left(t, z, \left(\left(-i\right) \cdot c\right) \cdot \mathsf{fma}\left(c, b, a\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(\left(-i\right) \cdot c\right) \cdot \mathsf{fma}\left(c, b, a\right)\right)\right)
double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r658184 = 2.0;
        double r658185 = x;
        double r658186 = y;
        double r658187 = r658185 * r658186;
        double r658188 = z;
        double r658189 = t;
        double r658190 = r658188 * r658189;
        double r658191 = r658187 + r658190;
        double r658192 = a;
        double r658193 = b;
        double r658194 = c;
        double r658195 = r658193 * r658194;
        double r658196 = r658192 + r658195;
        double r658197 = r658196 * r658194;
        double r658198 = i;
        double r658199 = r658197 * r658198;
        double r658200 = r658191 - r658199;
        double r658201 = r658184 * r658200;
        return r658201;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r658202 = 2.0;
        double r658203 = y;
        double r658204 = x;
        double r658205 = t;
        double r658206 = z;
        double r658207 = i;
        double r658208 = -r658207;
        double r658209 = c;
        double r658210 = r658208 * r658209;
        double r658211 = b;
        double r658212 = a;
        double r658213 = fma(r658209, r658211, r658212);
        double r658214 = r658210 * r658213;
        double r658215 = fma(r658205, r658206, r658214);
        double r658216 = fma(r658203, r658204, r658215);
        double r658217 = r658202 * r658216;
        return r658217;
}

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.5
Herbie1.5
\[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. Simplified6.1

    \[\leadsto \color{blue}{2 \cdot \mathsf{fma}\left(y, x, z \cdot t - \left(c \cdot \mathsf{fma}\left(c, b, a\right)\right) \cdot i\right)}\]
  3. Taylor expanded around inf 8.9

    \[\leadsto 2 \cdot \mathsf{fma}\left(y, x, \color{blue}{t \cdot z - \left(i \cdot \left(b \cdot {c}^{2}\right) + a \cdot \left(i \cdot c\right)\right)}\right)\]
  4. Simplified6.1

    \[\leadsto 2 \cdot \mathsf{fma}\left(y, x, \color{blue}{\mathsf{fma}\left(t, z, \left(-i\right) \cdot \left(c \cdot \mathsf{fma}\left(c, b, a\right)\right)\right)}\right)\]
  5. Using strategy rm
  6. Applied associate-*r*1.5

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

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

Reproduce

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