Average Error: 6.2 → 1.8
Time: 34.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 \left(\mathsf{fma}\left(y, x, t \cdot z\right) - \left(i \cdot c\right) \cdot \mathsf{fma}\left(c, b, a\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 \left(\mathsf{fma}\left(y, x, t \cdot z\right) - \left(i \cdot c\right) \cdot \mathsf{fma}\left(c, b, a\right)\right)
double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r28317484 = 2.0;
        double r28317485 = x;
        double r28317486 = y;
        double r28317487 = r28317485 * r28317486;
        double r28317488 = z;
        double r28317489 = t;
        double r28317490 = r28317488 * r28317489;
        double r28317491 = r28317487 + r28317490;
        double r28317492 = a;
        double r28317493 = b;
        double r28317494 = c;
        double r28317495 = r28317493 * r28317494;
        double r28317496 = r28317492 + r28317495;
        double r28317497 = r28317496 * r28317494;
        double r28317498 = i;
        double r28317499 = r28317497 * r28317498;
        double r28317500 = r28317491 - r28317499;
        double r28317501 = r28317484 * r28317500;
        return r28317501;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r28317502 = 2.0;
        double r28317503 = y;
        double r28317504 = x;
        double r28317505 = t;
        double r28317506 = z;
        double r28317507 = r28317505 * r28317506;
        double r28317508 = fma(r28317503, r28317504, r28317507);
        double r28317509 = i;
        double r28317510 = c;
        double r28317511 = r28317509 * r28317510;
        double r28317512 = b;
        double r28317513 = a;
        double r28317514 = fma(r28317510, r28317512, r28317513);
        double r28317515 = r28317511 * r28317514;
        double r28317516 = r28317508 - r28317515;
        double r28317517 = r28317502 * r28317516;
        return r28317517;
}

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

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

    \[\leadsto \color{blue}{2 \cdot \left(\mathsf{fma}\left(t, z, y \cdot x\right) - i \cdot \left(\mathsf{fma}\left(b, c, a\right) \cdot c\right)\right)}\]
  3. Taylor expanded around inf 8.7

    \[\leadsto 2 \cdot \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \color{blue}{\left(i \cdot \left(b \cdot {c}^{2}\right) + a \cdot \left(i \cdot c\right)\right)}\right)\]
  4. Simplified5.1

    \[\leadsto 2 \cdot \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \color{blue}{\left(\mathsf{fma}\left(c, b, a\right) \cdot i\right) \cdot c}\right)\]
  5. Using strategy rm
  6. Applied associate-*l*1.8

    \[\leadsto 2 \cdot \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \color{blue}{\mathsf{fma}\left(c, b, a\right) \cdot \left(i \cdot c\right)}\right)\]
  7. Taylor expanded around inf 1.8

    \[\leadsto 2 \cdot \left(\color{blue}{\left(t \cdot z + x \cdot y\right)} - \mathsf{fma}\left(c, b, a\right) \cdot \left(i \cdot c\right)\right)\]
  8. Simplified1.8

    \[\leadsto 2 \cdot \left(\color{blue}{\mathsf{fma}\left(y, x, t \cdot z\right)} - \mathsf{fma}\left(c, b, a\right) \cdot \left(i \cdot c\right)\right)\]
  9. Final simplification1.8

    \[\leadsto 2 \cdot \left(\mathsf{fma}\left(y, x, t \cdot z\right) - \left(i \cdot c\right) \cdot \mathsf{fma}\left(c, b, a\right)\right)\]

Reproduce

herbie shell --seed 2019172 +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"

  :herbie-target
  (* 2.0 (- (+ (* x y) (* z t)) (* (+ a (* b c)) (* c i))))

  (* 2.0 (- (+ (* x y) (* z t)) (* (* (+ a (* b c)) c) i))))