Average Error: 0.4 → 0.3
Time: 17.4s
Precision: 64
\[1 \le a \le 2 \le b \le 4 \le c \le 8 \le d \le 16 \le e \le 32\]
\[\left(\left(\left(e + d\right) + c\right) + b\right) + a\]
\[\mathsf{fma}\left(\sqrt{c}, \sqrt{c}, b + a\right) + \left(d + e\right)\]
\left(\left(\left(e + d\right) + c\right) + b\right) + a
\mathsf{fma}\left(\sqrt{c}, \sqrt{c}, b + a\right) + \left(d + e\right)
double f(double a, double b, double c, double d, double e) {
        double r3536202 = e;
        double r3536203 = d;
        double r3536204 = r3536202 + r3536203;
        double r3536205 = c;
        double r3536206 = r3536204 + r3536205;
        double r3536207 = b;
        double r3536208 = r3536206 + r3536207;
        double r3536209 = a;
        double r3536210 = r3536208 + r3536209;
        return r3536210;
}

double f(double a, double b, double c, double d, double e) {
        double r3536211 = c;
        double r3536212 = sqrt(r3536211);
        double r3536213 = b;
        double r3536214 = a;
        double r3536215 = r3536213 + r3536214;
        double r3536216 = fma(r3536212, r3536212, r3536215);
        double r3536217 = d;
        double r3536218 = e;
        double r3536219 = r3536217 + r3536218;
        double r3536220 = r3536216 + r3536219;
        return r3536220;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus d

Bits error versus e

Target

Original0.4
Target0.2
Herbie0.3
\[\left(d + \left(c + \left(a + b\right)\right)\right) + e\]

Derivation

  1. Initial program 0.4

    \[\left(\left(\left(e + d\right) + c\right) + b\right) + a\]
  2. Using strategy rm
  3. Applied associate-+l+0.3

    \[\leadsto \color{blue}{\left(\left(e + d\right) + c\right) + \left(b + a\right)}\]
  4. Using strategy rm
  5. Applied associate-+l+0.3

    \[\leadsto \color{blue}{\left(e + d\right) + \left(c + \left(b + a\right)\right)}\]
  6. Using strategy rm
  7. Applied add-sqr-sqrt0.3

    \[\leadsto \left(e + d\right) + \left(\color{blue}{\sqrt{c} \cdot \sqrt{c}} + \left(b + a\right)\right)\]
  8. Applied fma-def0.3

    \[\leadsto \left(e + d\right) + \color{blue}{\mathsf{fma}\left(\sqrt{c}, \sqrt{c}, b + a\right)}\]
  9. Final simplification0.3

    \[\leadsto \mathsf{fma}\left(\sqrt{c}, \sqrt{c}, b + a\right) + \left(d + e\right)\]

Reproduce

herbie shell --seed 2019139 +o rules:numerics
(FPCore (a b c d e)
  :name "Expression 1, p15"
  :pre (<= 1 a 2 b 4 c 8 d 16 e 32)

  :herbie-target
  (+ (+ d (+ c (+ a b))) e)

  (+ (+ (+ (+ e d) c) b) a))