Average Error: 0.4 → 0.2
Time: 16.7s
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 r58007 = e;
        double r58008 = d;
        double r58009 = r58007 + r58008;
        double r58010 = c;
        double r58011 = r58009 + r58010;
        double r58012 = b;
        double r58013 = r58011 + r58012;
        double r58014 = a;
        double r58015 = r58013 + r58014;
        return r58015;
}

double f(double a, double b, double c, double d, double e) {
        double r58016 = e;
        double r58017 = c;
        double r58018 = a;
        double r58019 = b;
        double r58020 = r58018 + r58019;
        double r58021 = d;
        double r58022 = r58020 + r58021;
        double r58023 = r58017 + r58022;
        double r58024 = r58016 + r58023;
        double r58025 = expm1(r58024);
        double r58026 = log1p(r58025);
        return r58026;
}

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 2019194 +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))