Average Error: 3.7 → 1.4
Time: 9.1s
Precision: binary64
\[-14 \leq a \land a \leq -13 \land -3 \leq b \land b \leq -2 \land 3 \leq c \land c \leq 3.5 \land 12.5 \leq d \land d \leq 13.5\]
\[\left(a + \left(b + \left(c + d\right)\right)\right) \cdot 2\]
\[\log \left(e^{\log \left(e^{d} \cdot \left(e^{b + c} \cdot e^{a}\right)\right)}\right) \cdot 2\]
\left(a + \left(b + \left(c + d\right)\right)\right) \cdot 2
\log \left(e^{\log \left(e^{d} \cdot \left(e^{b + c} \cdot e^{a}\right)\right)}\right) \cdot 2
(FPCore (a b c d) :precision binary64 (* (+ a (+ b (+ c d))) 2.0))
(FPCore (a b c d)
 :precision binary64
 (* (log (exp (log (* (exp d) (* (exp (+ b c)) (exp a)))))) 2.0))
double code(double a, double b, double c, double d) {
	return (a + (b + (c + d))) * 2.0;
}
double code(double a, double b, double c, double d) {
	return log(exp(log(exp(d) * (exp(b + c) * exp(a))))) * 2.0;
}

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
Herbie1.4
\[\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-exp_binary64_21633.7

    \[\leadsto \left(a + \left(b + \left(c + \color{blue}{\log \left(e^{d}\right)}\right)\right)\right) \cdot 2\]
  4. Applied add-log-exp_binary64_21633.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-log_binary64_22153.7

    \[\leadsto \left(a + \left(b + \color{blue}{\log \left(e^{c} \cdot e^{d}\right)}\right)\right) \cdot 2\]
  6. Applied add-log-exp_binary64_21633.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-log_binary64_22152.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-exp_binary64_21632.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-log_binary64_22151.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. Simplified3.0

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

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

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

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

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

    \[\leadsto \log \left(e^{\color{blue}{\log \left(e^{d} \cdot \left(e^{b + c} \cdot e^{a}\right)\right)}}\right) \cdot 2\]
  17. Final simplification1.4

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

Reproduce

herbie shell --seed 2021027 
(FPCore (a b c d)
  :name "Expression, p6"
  :precision binary64
  :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))