Average Error: 6.1 → 1.8
Time: 16.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(-\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 r866492 = 2.0;
        double r866493 = x;
        double r866494 = y;
        double r866495 = r866493 * r866494;
        double r866496 = z;
        double r866497 = t;
        double r866498 = r866496 * r866497;
        double r866499 = r866495 + r866498;
        double r866500 = a;
        double r866501 = b;
        double r866502 = c;
        double r866503 = r866501 * r866502;
        double r866504 = r866500 + r866503;
        double r866505 = r866504 * r866502;
        double r866506 = i;
        double r866507 = r866505 * r866506;
        double r866508 = r866499 - r866507;
        double r866509 = r866492 * r866508;
        return r866509;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r866510 = 2.0;
        double r866511 = y;
        double r866512 = x;
        double r866513 = t;
        double r866514 = z;
        double r866515 = c;
        double r866516 = b;
        double r866517 = a;
        double r866518 = fma(r866515, r866516, r866517);
        double r866519 = -r866518;
        double r866520 = i;
        double r866521 = r866515 * r866520;
        double r866522 = r866519 * r866521;
        double r866523 = fma(r866513, r866514, r866522);
        double r866524 = fma(r866511, r866512, r866523);
        double r866525 = r866510 * r866524;
        return r866525;
}

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.8
Herbie1.8
\[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. Simplified1.8

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

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