Average Error: 0.1 → 0.1
Time: 6.5s
Precision: 64
\[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b\]
\[\left(x + y\right) + \mathsf{fma}\left(b, a - 0.5, z - z \cdot \log t\right)\]
\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b
\left(x + y\right) + \mathsf{fma}\left(b, a - 0.5, z - z \cdot \log t\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r406090 = x;
        double r406091 = y;
        double r406092 = r406090 + r406091;
        double r406093 = z;
        double r406094 = r406092 + r406093;
        double r406095 = t;
        double r406096 = log(r406095);
        double r406097 = r406093 * r406096;
        double r406098 = r406094 - r406097;
        double r406099 = a;
        double r406100 = 0.5;
        double r406101 = r406099 - r406100;
        double r406102 = b;
        double r406103 = r406101 * r406102;
        double r406104 = r406098 + r406103;
        return r406104;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r406105 = x;
        double r406106 = y;
        double r406107 = r406105 + r406106;
        double r406108 = b;
        double r406109 = a;
        double r406110 = 0.5;
        double r406111 = r406109 - r406110;
        double r406112 = z;
        double r406113 = t;
        double r406114 = log(r406113);
        double r406115 = r406112 * r406114;
        double r406116 = r406112 - r406115;
        double r406117 = fma(r406108, r406111, r406116);
        double r406118 = r406107 + r406117;
        return r406118;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Bits error versus b

Target

Original0.1
Target0.3
Herbie0.1
\[\left(\left(x + y\right) + \frac{\left(1 - {\left(\log t\right)}^{2}\right) \cdot z}{1 + \log t}\right) + \left(a - 0.5\right) \cdot b\]

Derivation

  1. Initial program 0.1

    \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b\]
  2. Using strategy rm
  3. Applied associate--l+0.1

    \[\leadsto \color{blue}{\left(\left(x + y\right) + \left(z - z \cdot \log t\right)\right)} + \left(a - 0.5\right) \cdot b\]
  4. Applied associate-+l+0.1

    \[\leadsto \color{blue}{\left(x + y\right) + \left(\left(z - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b\right)}\]
  5. Simplified0.1

    \[\leadsto \left(x + y\right) + \color{blue}{\mathsf{fma}\left(b, a - 0.5, z - z \cdot \log t\right)}\]
  6. Final simplification0.1

    \[\leadsto \left(x + y\right) + \mathsf{fma}\left(b, a - 0.5, z - z \cdot \log t\right)\]

Reproduce

herbie shell --seed 2020057 +o rules:numerics
(FPCore (x y z t a b)
  :name "Numeric.SpecFunctions:logBeta from math-functions-0.1.5.2, A"
  :precision binary64

  :herbie-target
  (+ (+ (+ x y) (/ (* (- 1 (pow (log t) 2)) z) (+ 1 (log t)))) (* (- a 0.5) b))

  (+ (- (+ (+ x y) z) (* z (log t))) (* (- a 0.5) b)))