Average Error: 3.7 → 0
Time: 9.2s
Precision: 64
\[-14 \le a \le -13 \land -3 \le b \le -2 \land 3 \le c \le 3.5 \land 12.5 \le d \le 13.5\]
\[\left(a + \left(b + \left(c + d\right)\right)\right) \cdot 2\]
\[2 \cdot \left(\left(b + c\right) + \left(a + d\right)\right)\]
\left(a + \left(b + \left(c + d\right)\right)\right) \cdot 2
2 \cdot \left(\left(b + c\right) + \left(a + d\right)\right)
double f(double a, double b, double c, double d) {
        double r4360710 = a;
        double r4360711 = b;
        double r4360712 = c;
        double r4360713 = d;
        double r4360714 = r4360712 + r4360713;
        double r4360715 = r4360711 + r4360714;
        double r4360716 = r4360710 + r4360715;
        double r4360717 = 2.0;
        double r4360718 = r4360716 * r4360717;
        return r4360718;
}

double f(double a, double b, double c, double d) {
        double r4360719 = 2.0;
        double r4360720 = b;
        double r4360721 = c;
        double r4360722 = r4360720 + r4360721;
        double r4360723 = a;
        double r4360724 = d;
        double r4360725 = r4360723 + r4360724;
        double r4360726 = r4360722 + r4360725;
        double r4360727 = r4360719 * r4360726;
        return r4360727;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus d

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original3.7
Target3.8
Herbie0
\[\left(a + b\right) \cdot 2 + \left(c + d\right) \cdot 2\]

Derivation

  1. Initial program 3.7

    \[\left(a + \left(b + \left(c + d\right)\right)\right) \cdot 2\]
  2. Using strategy rm
  3. Applied add-log-exp3.7

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

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

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

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

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

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

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

    \[\leadsto \log \color{blue}{\left(e^{\left(b + \left(a + d\right)\right) + c}\right)} \cdot 2\]
  11. Using strategy rm
  12. Applied exp-sum1.2

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

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

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

    \[\leadsto \left(\left(\left(d + a\right) + b\right) + \color{blue}{c}\right) \cdot 2\]
  16. Using strategy rm
  17. Applied associate-+l+0

    \[\leadsto \color{blue}{\left(\left(d + a\right) + \left(b + c\right)\right)} \cdot 2\]
  18. Final simplification0

    \[\leadsto 2 \cdot \left(\left(b + c\right) + \left(a + d\right)\right)\]

Reproduce

herbie shell --seed 2019163 
(FPCore (a b c d)
  :name "Expression, p6"
  :pre (and (<= -14 a -13) (<= -3 b -2) (<= 3 c 3.5) (<= 12.5 d 13.5))

  :herbie-target
  (+ (* (+ a b) 2) (* (+ c d) 2))

  (* (+ a (+ b (+ c d))) 2))