Average Error: 6.3 → 1.9
Time: 9.3s
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 r848663 = 2.0;
        double r848664 = x;
        double r848665 = y;
        double r848666 = r848664 * r848665;
        double r848667 = z;
        double r848668 = t;
        double r848669 = r848667 * r848668;
        double r848670 = r848666 + r848669;
        double r848671 = a;
        double r848672 = b;
        double r848673 = c;
        double r848674 = r848672 * r848673;
        double r848675 = r848671 + r848674;
        double r848676 = r848675 * r848673;
        double r848677 = i;
        double r848678 = r848676 * r848677;
        double r848679 = r848670 - r848678;
        double r848680 = r848663 * r848679;
        return r848680;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r848681 = 2.0;
        double r848682 = t;
        double r848683 = z;
        double r848684 = x;
        double r848685 = y;
        double r848686 = r848684 * r848685;
        double r848687 = fma(r848682, r848683, r848686);
        double r848688 = c;
        double r848689 = b;
        double r848690 = a;
        double r848691 = fma(r848688, r848689, r848690);
        double r848692 = -r848691;
        double r848693 = i;
        double r848694 = r848688 * r848693;
        double r848695 = r848692 * r848694;
        double r848696 = r848681 * r848695;
        double r848697 = fma(r848681, r848687, r848696);
        return r848697;
}

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.3
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.3

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