Average Error: 0.4 → 0.2
Time: 8.0s
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\]
\[e + \mathsf{fma}\left(\sqrt{d}, \sqrt{d}, c + \left(b + a\right)\right)\]
\left(\left(\left(e + d\right) + c\right) + b\right) + a
e + \mathsf{fma}\left(\sqrt{d}, \sqrt{d}, c + \left(b + a\right)\right)
double f(double a, double b, double c, double d, double e) {
        double r116254 = e;
        double r116255 = d;
        double r116256 = r116254 + r116255;
        double r116257 = c;
        double r116258 = r116256 + r116257;
        double r116259 = b;
        double r116260 = r116258 + r116259;
        double r116261 = a;
        double r116262 = r116260 + r116261;
        return r116262;
}

double f(double a, double b, double c, double d, double e) {
        double r116263 = e;
        double r116264 = d;
        double r116265 = sqrt(r116264);
        double r116266 = c;
        double r116267 = b;
        double r116268 = a;
        double r116269 = r116267 + r116268;
        double r116270 = r116266 + r116269;
        double r116271 = fma(r116265, r116265, r116270);
        double r116272 = r116263 + r116271;
        return r116272;
}

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.2
\[\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 associate-+l+0.2

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

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

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

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

Reproduce

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

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

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