Average Error: 0.4 → 0.3
Time: 5.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\]
\[\left(e + d\right) + \mathsf{expm1}\left(\mathsf{log1p}\left(c + \left(b + a\right)\right)\right)\]
\left(\left(\left(e + d\right) + c\right) + b\right) + a
\left(e + d\right) + \mathsf{expm1}\left(\mathsf{log1p}\left(c + \left(b + a\right)\right)\right)
double f(double a, double b, double c, double d, double e) {
        double r87955 = e;
        double r87956 = d;
        double r87957 = r87955 + r87956;
        double r87958 = c;
        double r87959 = r87957 + r87958;
        double r87960 = b;
        double r87961 = r87959 + r87960;
        double r87962 = a;
        double r87963 = r87961 + r87962;
        return r87963;
}

double f(double a, double b, double c, double d, double e) {
        double r87964 = e;
        double r87965 = d;
        double r87966 = r87964 + r87965;
        double r87967 = c;
        double r87968 = b;
        double r87969 = a;
        double r87970 = r87968 + r87969;
        double r87971 = r87967 + r87970;
        double r87972 = log1p(r87971);
        double r87973 = expm1(r87972);
        double r87974 = r87966 + r87973;
        return r87974;
}

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.3
\[\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. Using strategy rm
  3. Applied associate-+l+0.3

    \[\leadsto \color{blue}{\left(\left(e + d\right) + c\right) + \left(b + a\right)}\]
  4. Using strategy rm
  5. Applied associate-+l+0.3

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

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

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

Reproduce

herbie shell --seed 2020047 +o rules:numerics
(FPCore (a b c d e)
  :name "Expression 1, p15"
  :precision binary64
  :pre (<= 1 a 2 b 4 c 8 d 16 e 32)

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

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