Average Error: 0.1 → 0.1
Time: 27.3s
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 r193375 = x;
        double r193376 = y;
        double r193377 = r193375 + r193376;
        double r193378 = z;
        double r193379 = r193377 + r193378;
        double r193380 = t;
        double r193381 = log(r193380);
        double r193382 = r193378 * r193381;
        double r193383 = r193379 - r193382;
        double r193384 = a;
        double r193385 = 0.5;
        double r193386 = r193384 - r193385;
        double r193387 = b;
        double r193388 = r193386 * r193387;
        double r193389 = r193383 + r193388;
        return r193389;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r193390 = z;
        double r193391 = 1.0;
        double r193392 = t;
        double r193393 = log(r193392);
        double r193394 = r193391 - r193393;
        double r193395 = a;
        double r193396 = 0.5;
        double r193397 = r193395 - r193396;
        double r193398 = b;
        double r193399 = x;
        double r193400 = y;
        double r193401 = r193399 + r193400;
        double r193402 = fma(r193397, r193398, r193401);
        double r193403 = fma(r193390, r193394, r193402);
        return r193403;
}

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.5
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 2019322 +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)))