Average Error: 0.4 → 0.2
Time: 2.8s
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}, a + \left(b + c\right)\right)\]
\left(\left(\left(e + d\right) + c\right) + b\right) + a
e + \mathsf{fma}\left(\sqrt{d}, \sqrt{d}, a + \left(b + c\right)\right)
double f(double a, double b, double c, double d, double e) {
        double r111971 = e;
        double r111972 = d;
        double r111973 = r111971 + r111972;
        double r111974 = c;
        double r111975 = r111973 + r111974;
        double r111976 = b;
        double r111977 = r111975 + r111976;
        double r111978 = a;
        double r111979 = r111977 + r111978;
        return r111979;
}

double f(double a, double b, double c, double d, double e) {
        double r111980 = e;
        double r111981 = d;
        double r111982 = sqrt(r111981);
        double r111983 = a;
        double r111984 = b;
        double r111985 = c;
        double r111986 = r111984 + r111985;
        double r111987 = r111983 + r111986;
        double r111988 = fma(r111982, r111982, r111987);
        double r111989 = r111980 + r111988;
        return r111989;
}

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) + \left(c + b\right)\right)} + a\]
  4. Using strategy rm
  5. Applied associate-+l+0.3

    \[\leadsto \color{blue}{\left(e + d\right) + \left(\left(c + b\right) + a\right)}\]
  6. Simplified0.3

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

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

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

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

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

Reproduce

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