Average Error: 6.0 → 1.6
Time: 9.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)\]
\[\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 r674523 = 2.0;
        double r674524 = x;
        double r674525 = y;
        double r674526 = r674524 * r674525;
        double r674527 = z;
        double r674528 = t;
        double r674529 = r674527 * r674528;
        double r674530 = r674526 + r674529;
        double r674531 = a;
        double r674532 = b;
        double r674533 = c;
        double r674534 = r674532 * r674533;
        double r674535 = r674531 + r674534;
        double r674536 = r674535 * r674533;
        double r674537 = i;
        double r674538 = r674536 * r674537;
        double r674539 = r674530 - r674538;
        double r674540 = r674523 * r674539;
        return r674540;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r674541 = 2.0;
        double r674542 = t;
        double r674543 = z;
        double r674544 = x;
        double r674545 = y;
        double r674546 = r674544 * r674545;
        double r674547 = fma(r674542, r674543, r674546);
        double r674548 = c;
        double r674549 = b;
        double r674550 = a;
        double r674551 = fma(r674548, r674549, r674550);
        double r674552 = -r674551;
        double r674553 = i;
        double r674554 = r674548 * r674553;
        double r674555 = r674552 * r674554;
        double r674556 = r674541 * r674555;
        double r674557 = fma(r674541, r674547, r674556);
        return r674557;
}

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

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

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

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

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

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