Average Error: 6.4 → 1.8
Time: 22.4s
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 r775491 = 2.0;
        double r775492 = x;
        double r775493 = y;
        double r775494 = r775492 * r775493;
        double r775495 = z;
        double r775496 = t;
        double r775497 = r775495 * r775496;
        double r775498 = r775494 + r775497;
        double r775499 = a;
        double r775500 = b;
        double r775501 = c;
        double r775502 = r775500 * r775501;
        double r775503 = r775499 + r775502;
        double r775504 = r775503 * r775501;
        double r775505 = i;
        double r775506 = r775504 * r775505;
        double r775507 = r775498 - r775506;
        double r775508 = r775491 * r775507;
        return r775508;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r775509 = 2.0;
        double r775510 = y;
        double r775511 = x;
        double r775512 = t;
        double r775513 = z;
        double r775514 = c;
        double r775515 = b;
        double r775516 = a;
        double r775517 = fma(r775514, r775515, r775516);
        double r775518 = -r775517;
        double r775519 = i;
        double r775520 = r775514 * r775519;
        double r775521 = r775518 * r775520;
        double r775522 = fma(r775512, r775513, r775521);
        double r775523 = fma(r775510, r775511, r775522);
        double r775524 = r775509 * r775523;
        return r775524;
}

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.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.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.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 2020042 +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))))