Average Error: 6.4 → 1.9
Time: 8.6s
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 r639582 = 2.0;
        double r639583 = x;
        double r639584 = y;
        double r639585 = r639583 * r639584;
        double r639586 = z;
        double r639587 = t;
        double r639588 = r639586 * r639587;
        double r639589 = r639585 + r639588;
        double r639590 = a;
        double r639591 = b;
        double r639592 = c;
        double r639593 = r639591 * r639592;
        double r639594 = r639590 + r639593;
        double r639595 = r639594 * r639592;
        double r639596 = i;
        double r639597 = r639595 * r639596;
        double r639598 = r639589 - r639597;
        double r639599 = r639582 * r639598;
        return r639599;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r639600 = 2.0;
        double r639601 = t;
        double r639602 = z;
        double r639603 = x;
        double r639604 = y;
        double r639605 = r639603 * r639604;
        double r639606 = fma(r639601, r639602, r639605);
        double r639607 = c;
        double r639608 = b;
        double r639609 = a;
        double r639610 = fma(r639607, r639608, r639609);
        double r639611 = -r639610;
        double r639612 = i;
        double r639613 = r639607 * r639612;
        double r639614 = r639611 * r639613;
        double r639615 = r639600 * r639614;
        double r639616 = fma(r639600, r639606, r639615);
        return r639616;
}

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