Average Error: 0.4 → 0.0
Time: 31.5s
Precision: 64
\[\left(\left(\left(e + d\right) + c\right) + b\right) + a\]
\[\log \left(e^{e} \cdot \left(e^{a} \cdot \left(e^{b} \cdot \left(e^{d} \cdot e^{c}\right)\right)\right)\right)\]
double f(double a, double b, double c, double d, double e) {
        double r8682682 = e;
        double r8682683 = d;
        double r8682684 = r8682682 + r8682683;
        double r8682685 = c;
        double r8682686 = r8682684 + r8682685;
        double r8682687 = b;
        double r8682688 = r8682686 + r8682687;
        double r8682689 = a;
        double r8682690 = r8682688 + r8682689;
        return r8682690;
}

double f(double a, double b, double c, double d, double e) {
        double r8682691 = e;
        double r8682692 = exp(r8682691);
        double r8682693 = a;
        double r8682694 = exp(r8682693);
        double r8682695 = b;
        double r8682696 = exp(r8682695);
        double r8682697 = d;
        double r8682698 = exp(r8682697);
        double r8682699 = c;
        double r8682700 = exp(r8682699);
        double r8682701 = r8682698 * r8682700;
        double r8682702 = r8682696 * r8682701;
        double r8682703 = r8682694 * r8682702;
        double r8682704 = r8682692 * r8682703;
        double r8682705 = log(r8682704);
        return r8682705;
}

\left(\left(\left(e + d\right) + c\right) + b\right) + a
\log \left(e^{e} \cdot \left(e^{a} \cdot \left(e^{b} \cdot \left(e^{d} \cdot e^{c}\right)\right)\right)\right)

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.0
\[\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 add-log-exp0.4

    \[\leadsto \left(\left(\left(e + d\right) + c\right) + b\right) + \color{blue}{\log \left(e^{a}\right)}\]
  4. Applied add-log-exp0.4

    \[\leadsto \left(\left(\left(e + d\right) + c\right) + \color{blue}{\log \left(e^{b}\right)}\right) + \log \left(e^{a}\right)\]
  5. Applied add-log-exp0.4

    \[\leadsto \left(\left(\left(e + d\right) + \color{blue}{\log \left(e^{c}\right)}\right) + \log \left(e^{b}\right)\right) + \log \left(e^{a}\right)\]
  6. Applied add-log-exp0.4

    \[\leadsto \left(\left(\color{blue}{\log \left(e^{e + d}\right)} + \log \left(e^{c}\right)\right) + \log \left(e^{b}\right)\right) + \log \left(e^{a}\right)\]
  7. Applied sum-log0.4

    \[\leadsto \left(\color{blue}{\log \left(e^{e + d} \cdot e^{c}\right)} + \log \left(e^{b}\right)\right) + \log \left(e^{a}\right)\]
  8. Applied sum-log0.3

    \[\leadsto \color{blue}{\log \left(\left(e^{e + d} \cdot e^{c}\right) \cdot e^{b}\right)} + \log \left(e^{a}\right)\]
  9. Applied sum-log0.2

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

    \[\leadsto \log \color{blue}{\left(e^{\left(d + e\right) + \left(\left(c + a\right) + b\right)}\right)}\]
  11. Taylor expanded around -inf 0.3

    \[\leadsto \log \color{blue}{\left(e^{e + \left(a + \left(b + \left(c + d\right)\right)\right)}\right)}\]
  12. Using strategy rm
  13. Applied add-log-exp0.3

    \[\leadsto \log \left(e^{e + \left(a + \left(b + \left(c + \color{blue}{\log \left(e^{d}\right)}\right)\right)\right)}\right)\]
  14. Applied add-log-exp0.3

    \[\leadsto \log \left(e^{e + \left(a + \left(b + \left(\color{blue}{\log \left(e^{c}\right)} + \log \left(e^{d}\right)\right)\right)\right)}\right)\]
  15. Applied sum-log0.3

    \[\leadsto \log \left(e^{e + \left(a + \left(b + \color{blue}{\log \left(e^{c} \cdot e^{d}\right)}\right)\right)}\right)\]
  16. Applied add-log-exp0.3

    \[\leadsto \log \left(e^{e + \left(a + \left(\color{blue}{\log \left(e^{b}\right)} + \log \left(e^{c} \cdot e^{d}\right)\right)\right)}\right)\]
  17. Applied sum-log0.2

    \[\leadsto \log \left(e^{e + \left(a + \color{blue}{\log \left(e^{b} \cdot \left(e^{c} \cdot e^{d}\right)\right)}\right)}\right)\]
  18. Applied add-log-exp0.2

    \[\leadsto \log \left(e^{e + \left(\color{blue}{\log \left(e^{a}\right)} + \log \left(e^{b} \cdot \left(e^{c} \cdot e^{d}\right)\right)\right)}\right)\]
  19. Applied sum-log0.2

    \[\leadsto \log \left(e^{e + \color{blue}{\log \left(e^{a} \cdot \left(e^{b} \cdot \left(e^{c} \cdot e^{d}\right)\right)\right)}}\right)\]
  20. Applied add-log-exp0.2

    \[\leadsto \log \left(e^{\color{blue}{\log \left(e^{e}\right)} + \log \left(e^{a} \cdot \left(e^{b} \cdot \left(e^{c} \cdot e^{d}\right)\right)\right)}\right)\]
  21. Applied sum-log0.0

    \[\leadsto \log \left(e^{\color{blue}{\log \left(e^{e} \cdot \left(e^{a} \cdot \left(e^{b} \cdot \left(e^{c} \cdot e^{d}\right)\right)\right)\right)}}\right)\]
  22. Applied rem-exp-log0.0

    \[\leadsto \log \color{blue}{\left(e^{e} \cdot \left(e^{a} \cdot \left(e^{b} \cdot \left(e^{c} \cdot e^{d}\right)\right)\right)\right)}\]
  23. Final simplification0.0

    \[\leadsto \log \left(e^{e} \cdot \left(e^{a} \cdot \left(e^{b} \cdot \left(e^{d} \cdot e^{c}\right)\right)\right)\right)\]

Reproduce

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