Average Error: 0.1 → 0.1
Time: 6.2s
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(b, a - 0.5, \mathsf{fma}\left(z, 1 - \log t, 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(b, a - 0.5, \mathsf{fma}\left(z, 1 - \log t, x + y\right)\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r300459 = x;
        double r300460 = y;
        double r300461 = r300459 + r300460;
        double r300462 = z;
        double r300463 = r300461 + r300462;
        double r300464 = t;
        double r300465 = log(r300464);
        double r300466 = r300462 * r300465;
        double r300467 = r300463 - r300466;
        double r300468 = a;
        double r300469 = 0.5;
        double r300470 = r300468 - r300469;
        double r300471 = b;
        double r300472 = r300470 * r300471;
        double r300473 = r300467 + r300472;
        return r300473;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r300474 = b;
        double r300475 = a;
        double r300476 = 0.5;
        double r300477 = r300475 - r300476;
        double r300478 = z;
        double r300479 = 1.0;
        double r300480 = t;
        double r300481 = log(r300480);
        double r300482 = r300479 - r300481;
        double r300483 = x;
        double r300484 = y;
        double r300485 = r300483 + r300484;
        double r300486 = fma(r300478, r300482, r300485);
        double r300487 = fma(r300474, r300477, r300486);
        return r300487;
}

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(b, a - 0.5, \left(\left(x + y\right) + z\right) - z \cdot \log t\right)}\]
  3. Taylor expanded around 0 0.1

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

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

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

Reproduce

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