Average Error: 6.2 → 1.8
Time: 34.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)\]
\[2 \cdot \mathsf{fma}\left(y, x, \mathsf{fma}\left(\left(-c\right) \cdot i, \mathsf{fma}\left(c, b, a\right), z \cdot t\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(\left(-c\right) \cdot i, \mathsf{fma}\left(c, b, a\right), z \cdot t\right)\right)
double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r455137 = 2.0;
        double r455138 = x;
        double r455139 = y;
        double r455140 = r455138 * r455139;
        double r455141 = z;
        double r455142 = t;
        double r455143 = r455141 * r455142;
        double r455144 = r455140 + r455143;
        double r455145 = a;
        double r455146 = b;
        double r455147 = c;
        double r455148 = r455146 * r455147;
        double r455149 = r455145 + r455148;
        double r455150 = r455149 * r455147;
        double r455151 = i;
        double r455152 = r455150 * r455151;
        double r455153 = r455144 - r455152;
        double r455154 = r455137 * r455153;
        return r455154;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r455155 = 2.0;
        double r455156 = y;
        double r455157 = x;
        double r455158 = c;
        double r455159 = -r455158;
        double r455160 = i;
        double r455161 = r455159 * r455160;
        double r455162 = b;
        double r455163 = a;
        double r455164 = fma(r455158, r455162, r455163);
        double r455165 = z;
        double r455166 = t;
        double r455167 = r455165 * r455166;
        double r455168 = fma(r455161, r455164, r455167);
        double r455169 = fma(r455156, r455157, r455168);
        double r455170 = r455155 * r455169;
        return r455170;
}

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.9
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 \mathsf{fma}\left(y, x, z \cdot t - \left(c \cdot \mathsf{fma}\left(c, b, a\right)\right) \cdot i\right)}\]
  3. Using strategy rm
  4. Applied associate-*l*5.4

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

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

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

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

Reproduce

herbie shell --seed 2019303 +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))))