Average Error: 6.4 → 1.8
Time: 23.0s
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 r758606 = 2.0;
        double r758607 = x;
        double r758608 = y;
        double r758609 = r758607 * r758608;
        double r758610 = z;
        double r758611 = t;
        double r758612 = r758610 * r758611;
        double r758613 = r758609 + r758612;
        double r758614 = a;
        double r758615 = b;
        double r758616 = c;
        double r758617 = r758615 * r758616;
        double r758618 = r758614 + r758617;
        double r758619 = r758618 * r758616;
        double r758620 = i;
        double r758621 = r758619 * r758620;
        double r758622 = r758613 - r758621;
        double r758623 = r758606 * r758622;
        return r758623;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r758624 = 2.0;
        double r758625 = y;
        double r758626 = x;
        double r758627 = t;
        double r758628 = z;
        double r758629 = c;
        double r758630 = b;
        double r758631 = a;
        double r758632 = fma(r758629, r758630, r758631);
        double r758633 = -r758632;
        double r758634 = i;
        double r758635 = r758629 * r758634;
        double r758636 = r758633 * r758635;
        double r758637 = fma(r758627, r758628, r758636);
        double r758638 = fma(r758625, r758626, r758637);
        double r758639 = r758624 * r758638;
        return r758639;
}

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