Average Error: 3.7 → 3.0
Time: 3.6s
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\]
\[\mathsf{log1p}\left(\log \left(e^{\mathsf{expm1}\left(d + \left(a + \left(b + c\right)\right)\right)}\right)\right) \cdot 2\]
\left(a + \left(b + \left(c + d\right)\right)\right) \cdot 2
\mathsf{log1p}\left(\log \left(e^{\mathsf{expm1}\left(d + \left(a + \left(b + c\right)\right)\right)}\right)\right) \cdot 2
double code(double a, double b, double c, double d) {
	return ((double) (((double) (a + ((double) (b + ((double) (c + d)))))) * 2.0));
}
double code(double a, double b, double c, double d) {
	return ((double) (((double) log1p(((double) log(((double) exp(((double) expm1(((double) (d + ((double) (a + ((double) (b + c)))))))))))))) * 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.9
Herbie3.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 log1p-expm1-u2.8

    \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(a + \left(\left(b + c\right) + d\right)\right)\right)} \cdot 2\]
  6. Using strategy rm
  7. Applied add-cbrt-cube2.9

    \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\color{blue}{\sqrt[3]{\left(\left(a + \left(\left(b + c\right) + d\right)\right) \cdot \left(a + \left(\left(b + c\right) + d\right)\right)\right) \cdot \left(a + \left(\left(b + c\right) + d\right)\right)}}\right)\right) \cdot 2\]
  8. Simplified2.9

    \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\sqrt[3]{\color{blue}{{\left(a + \left(\left(b + c\right) + d\right)\right)}^{3}}}\right)\right) \cdot 2\]
  9. Using strategy rm
  10. Applied add-log-exp3.0

    \[\leadsto \mathsf{log1p}\left(\color{blue}{\log \left(e^{\mathsf{expm1}\left(\sqrt[3]{{\left(a + \left(\left(b + c\right) + d\right)\right)}^{3}}\right)}\right)}\right) \cdot 2\]
  11. Simplified3.0

    \[\leadsto \mathsf{log1p}\left(\log \color{blue}{\left(e^{\mathsf{expm1}\left(d + \left(a + \left(b + c\right)\right)\right)}\right)}\right) \cdot 2\]
  12. Final simplification3.0

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

Reproduce

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