Average Error: 6.4 → 1.9
Time: 8.7s
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(t, z, x \cdot y\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(t, z, x \cdot y\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 r687240 = 2.0;
        double r687241 = x;
        double r687242 = y;
        double r687243 = r687241 * r687242;
        double r687244 = z;
        double r687245 = t;
        double r687246 = r687244 * r687245;
        double r687247 = r687243 + r687246;
        double r687248 = a;
        double r687249 = b;
        double r687250 = c;
        double r687251 = r687249 * r687250;
        double r687252 = r687248 + r687251;
        double r687253 = r687252 * r687250;
        double r687254 = i;
        double r687255 = r687253 * r687254;
        double r687256 = r687247 - r687255;
        double r687257 = r687240 * r687256;
        return r687257;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r687258 = 2.0;
        double r687259 = t;
        double r687260 = z;
        double r687261 = x;
        double r687262 = y;
        double r687263 = r687261 * r687262;
        double r687264 = fma(r687259, r687260, r687263);
        double r687265 = c;
        double r687266 = b;
        double r687267 = a;
        double r687268 = fma(r687265, r687266, r687267);
        double r687269 = -r687268;
        double r687270 = i;
        double r687271 = r687265 * r687270;
        double r687272 = r687269 * r687271;
        double r687273 = r687258 * r687272;
        double r687274 = fma(r687258, r687264, r687273);
        return r687274;
}

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.4
Target1.9
Herbie1.9
\[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.4

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

    \[\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. Taylor expanded around inf 1.9

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

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

    \[\leadsto \mathsf{fma}\left(2, \mathsf{fma}\left(t, z, x \cdot y\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 2020001 +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))))