Average Error: 6.4 → 1.7
Time: 8.5s
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 r676723 = 2.0;
        double r676724 = x;
        double r676725 = y;
        double r676726 = r676724 * r676725;
        double r676727 = z;
        double r676728 = t;
        double r676729 = r676727 * r676728;
        double r676730 = r676726 + r676729;
        double r676731 = a;
        double r676732 = b;
        double r676733 = c;
        double r676734 = r676732 * r676733;
        double r676735 = r676731 + r676734;
        double r676736 = r676735 * r676733;
        double r676737 = i;
        double r676738 = r676736 * r676737;
        double r676739 = r676730 - r676738;
        double r676740 = r676723 * r676739;
        return r676740;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r676741 = 2.0;
        double r676742 = t;
        double r676743 = z;
        double r676744 = x;
        double r676745 = y;
        double r676746 = r676744 * r676745;
        double r676747 = fma(r676742, r676743, r676746);
        double r676748 = c;
        double r676749 = b;
        double r676750 = a;
        double r676751 = fma(r676748, r676749, r676750);
        double r676752 = -r676751;
        double r676753 = i;
        double r676754 = r676748 * r676753;
        double r676755 = r676752 * r676754;
        double r676756 = r676741 * r676755;
        double r676757 = fma(r676741, r676747, r676756);
        return r676757;
}

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

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

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

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

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