Average Error: 0.4 → 0.2
Time: 12.5s
Precision: 64
\[1 \le a \le 2 \le b \le 4 \le c \le 8 \le d \le 16 \le e \le 32\]
\[\left(\left(\left(e + d\right) + c\right) + b\right) + a\]
\[\mathsf{log1p}\left(\mathsf{expm1}\left(e + \left(c + \left(\left(a + b\right) + d\right)\right)\right)\right)\]
\left(\left(\left(e + d\right) + c\right) + b\right) + a
\mathsf{log1p}\left(\mathsf{expm1}\left(e + \left(c + \left(\left(a + b\right) + d\right)\right)\right)\right)
double f(double a, double b, double c, double d, double e) {
        double r80124 = e;
        double r80125 = d;
        double r80126 = r80124 + r80125;
        double r80127 = c;
        double r80128 = r80126 + r80127;
        double r80129 = b;
        double r80130 = r80128 + r80129;
        double r80131 = a;
        double r80132 = r80130 + r80131;
        return r80132;
}

double f(double a, double b, double c, double d, double e) {
        double r80133 = e;
        double r80134 = c;
        double r80135 = a;
        double r80136 = b;
        double r80137 = r80135 + r80136;
        double r80138 = d;
        double r80139 = r80137 + r80138;
        double r80140 = r80134 + r80139;
        double r80141 = r80133 + r80140;
        double r80142 = expm1(r80141);
        double r80143 = log1p(r80142);
        return r80143;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus d

Bits error versus e

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.4
Target0.2
Herbie0.2
\[\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. Simplified0.3

    \[\leadsto \color{blue}{\left(c + \left(d + e\right)\right) + \left(b + a\right)}\]
  3. Using strategy rm
  4. Applied log1p-expm1-u0.3

    \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\left(c + \left(d + e\right)\right) + \left(b + a\right)\right)\right)}\]
  5. Simplified0.2

    \[\leadsto \mathsf{log1p}\left(\color{blue}{\mathsf{expm1}\left(\left(\left(b + a\right) + \left(d + c\right)\right) + e\right)}\right)\]
  6. Using strategy rm
  7. Applied associate-+r+0.2

    \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\color{blue}{\left(\left(\left(b + a\right) + d\right) + c\right)} + e\right)\right)\]
  8. Simplified0.2

    \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\left(\color{blue}{\left(d + \left(a + b\right)\right)} + c\right) + e\right)\right)\]
  9. Final simplification0.2

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

Reproduce

herbie shell --seed 2019174 +o rules:numerics
(FPCore (a b c d e)
  :name "Expression 1, p15"
  :pre (<= 1.0 a 2.0 b 4.0 c 8.0 d 16.0 e 32.0)

  :herbie-target
  (+ (+ d (+ c (+ a b))) e)

  (+ (+ (+ (+ e d) c) b) a))