Average Error: 3.7 → 0.0
Time: 9.4s
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(c + \left(b + \left(a + d\right)\right)\right)\]
\left(a + \left(b + \left(c + d\right)\right)\right) \cdot 2
2 \cdot \left(c + \left(b + \left(a + d\right)\right)\right)
double f(double a, double b, double c, double d) {
        double r6627912 = a;
        double r6627913 = b;
        double r6627914 = c;
        double r6627915 = d;
        double r6627916 = r6627914 + r6627915;
        double r6627917 = r6627913 + r6627916;
        double r6627918 = r6627912 + r6627917;
        double r6627919 = 2.0;
        double r6627920 = r6627918 * r6627919;
        return r6627920;
}

double f(double a, double b, double c, double d) {
        double r6627921 = 2.0;
        double r6627922 = c;
        double r6627923 = b;
        double r6627924 = a;
        double r6627925 = d;
        double r6627926 = r6627924 + r6627925;
        double r6627927 = r6627923 + r6627926;
        double r6627928 = r6627922 + r6627927;
        double r6627929 = r6627921 * r6627928;
        return r6627929;
}

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.0
\[\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 associate-+r+2.8

    \[\leadsto \left(a + \color{blue}{\left(\left(b + c\right) + d\right)}\right) \cdot 2\]
  4. Using strategy rm
  5. Applied add-log-exp2.8

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

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

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

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

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

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

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

    \[\leadsto \log \color{blue}{\left(e^{\left(a + \left(d + b\right)\right) + c}\right)} \cdot 2\]
  13. Using strategy rm
  14. Applied associate-+r+0.9

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

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

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

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

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

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

Reproduce

herbie shell --seed 2019172 
(FPCore (a b c d)
  :name "Expression, p6"
  :pre (and (<= -14.0 a -13.0) (<= -3.0 b -2.0) (<= 3.0 c 3.5) (<= 12.5 d 13.5))

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

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