Average Error: 6.5 → 1.9
Time: 10.1s
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), \sqrt{\sqrt{1}} \cdot \left(2 \cdot \left(\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)\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), \sqrt{\sqrt{1}} \cdot \left(2 \cdot \left(\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)\right)\right)\right)
double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r700192 = 2.0;
        double r700193 = x;
        double r700194 = y;
        double r700195 = r700193 * r700194;
        double r700196 = z;
        double r700197 = t;
        double r700198 = r700196 * r700197;
        double r700199 = r700195 + r700198;
        double r700200 = a;
        double r700201 = b;
        double r700202 = c;
        double r700203 = r700201 * r700202;
        double r700204 = r700200 + r700203;
        double r700205 = r700204 * r700202;
        double r700206 = i;
        double r700207 = r700205 * r700206;
        double r700208 = r700199 - r700207;
        double r700209 = r700192 * r700208;
        return r700209;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r700210 = 2.0;
        double r700211 = t;
        double r700212 = z;
        double r700213 = x;
        double r700214 = y;
        double r700215 = r700213 * r700214;
        double r700216 = fma(r700211, r700212, r700215);
        double r700217 = 1.0;
        double r700218 = sqrt(r700217);
        double r700219 = sqrt(r700218);
        double r700220 = c;
        double r700221 = b;
        double r700222 = a;
        double r700223 = fma(r700220, r700221, r700222);
        double r700224 = -r700223;
        double r700225 = i;
        double r700226 = r700220 * r700225;
        double r700227 = r700224 * r700226;
        double r700228 = r700210 * r700227;
        double r700229 = r700219 * r700228;
        double r700230 = fma(r700210, r700216, r700229);
        return r700230;
}

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

    \[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. Using strategy rm
  6. Applied add-sqr-sqrt2.2

    \[\leadsto \mathsf{fma}\left(2, \mathsf{fma}\left(t, z, x \cdot y\right), \color{blue}{\left(\sqrt{2} \cdot \sqrt{2}\right)} \cdot \left(\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)\right)\right)\]
  7. Applied associate-*l*2.1

    \[\leadsto \mathsf{fma}\left(2, \mathsf{fma}\left(t, z, x \cdot y\right), \color{blue}{\sqrt{2} \cdot \left(\sqrt{2} \cdot \left(\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)\right)\right)}\right)\]
  8. Using strategy rm
  9. Applied add-sqr-sqrt2.1

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

    \[\leadsto \mathsf{fma}\left(2, \mathsf{fma}\left(t, z, x \cdot y\right), \color{blue}{\left(\sqrt{\sqrt{2}} \cdot \sqrt{\sqrt{2}}\right)} \cdot \left(\sqrt{2} \cdot \left(\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)\right)\right)\right)\]
  11. Applied associate-*l*1.9

    \[\leadsto \mathsf{fma}\left(2, \mathsf{fma}\left(t, z, x \cdot y\right), \color{blue}{\sqrt{\sqrt{2}} \cdot \left(\sqrt{\sqrt{2}} \cdot \left(\sqrt{2} \cdot \left(\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)\right)\right)\right)}\right)\]
  12. Using strategy rm
  13. Applied *-un-lft-identity1.9

    \[\leadsto \mathsf{fma}\left(2, \mathsf{fma}\left(t, z, x \cdot y\right), \sqrt{\sqrt{\color{blue}{1 \cdot 2}}} \cdot \left(\sqrt{\sqrt{2}} \cdot \left(\sqrt{2} \cdot \left(\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)\right)\right)\right)\right)\]
  14. Applied sqrt-prod1.9

    \[\leadsto \mathsf{fma}\left(2, \mathsf{fma}\left(t, z, x \cdot y\right), \sqrt{\color{blue}{\sqrt{1} \cdot \sqrt{2}}} \cdot \left(\sqrt{\sqrt{2}} \cdot \left(\sqrt{2} \cdot \left(\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)\right)\right)\right)\right)\]
  15. Applied sqrt-prod1.9

    \[\leadsto \mathsf{fma}\left(2, \mathsf{fma}\left(t, z, x \cdot y\right), \color{blue}{\left(\sqrt{\sqrt{1}} \cdot \sqrt{\sqrt{2}}\right)} \cdot \left(\sqrt{\sqrt{2}} \cdot \left(\sqrt{2} \cdot \left(\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)\right)\right)\right)\right)\]
  16. Applied associate-*l*1.9

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

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

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

Reproduce

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