Average Error: 0.1 → 0.1
Time: 21.1s
Precision: 64
\[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b\]
\[\mathsf{fma}\left(z, 1 - \log t, \mathsf{fma}\left(a - 0.5, b, x + y\right)\right)\]
\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b
\mathsf{fma}\left(z, 1 - \log t, \mathsf{fma}\left(a - 0.5, b, x + y\right)\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r625262 = x;
        double r625263 = y;
        double r625264 = r625262 + r625263;
        double r625265 = z;
        double r625266 = r625264 + r625265;
        double r625267 = t;
        double r625268 = log(r625267);
        double r625269 = r625265 * r625268;
        double r625270 = r625266 - r625269;
        double r625271 = a;
        double r625272 = 0.5;
        double r625273 = r625271 - r625272;
        double r625274 = b;
        double r625275 = r625273 * r625274;
        double r625276 = r625270 + r625275;
        return r625276;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r625277 = z;
        double r625278 = 1.0;
        double r625279 = t;
        double r625280 = log(r625279);
        double r625281 = r625278 - r625280;
        double r625282 = a;
        double r625283 = 0.5;
        double r625284 = r625282 - r625283;
        double r625285 = b;
        double r625286 = x;
        double r625287 = y;
        double r625288 = r625286 + r625287;
        double r625289 = fma(r625284, r625285, r625288);
        double r625290 = fma(r625277, r625281, r625289);
        return r625290;
}

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. Simplified0.1

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

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

Reproduce

herbie shell --seed 2019350 +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)))