Average Error: 0.3 → 0.3
Time: 1.2m
Precision: 64
\[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t\]
\[\log \left(y + x\right) + \left(\mathsf{fma}\left(\log t, a, \log z\right) - \mathsf{fma}\left(\log t, 0.5, t\right)\right)\]
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t
\log \left(y + x\right) + \left(\mathsf{fma}\left(\log t, a, \log z\right) - \mathsf{fma}\left(\log t, 0.5, t\right)\right)
double f(double x, double y, double z, double t, double a) {
        double r2816401 = x;
        double r2816402 = y;
        double r2816403 = r2816401 + r2816402;
        double r2816404 = log(r2816403);
        double r2816405 = z;
        double r2816406 = log(r2816405);
        double r2816407 = r2816404 + r2816406;
        double r2816408 = t;
        double r2816409 = r2816407 - r2816408;
        double r2816410 = a;
        double r2816411 = 0.5;
        double r2816412 = r2816410 - r2816411;
        double r2816413 = log(r2816408);
        double r2816414 = r2816412 * r2816413;
        double r2816415 = r2816409 + r2816414;
        return r2816415;
}

double f(double x, double y, double z, double t, double a) {
        double r2816416 = y;
        double r2816417 = x;
        double r2816418 = r2816416 + r2816417;
        double r2816419 = log(r2816418);
        double r2816420 = t;
        double r2816421 = log(r2816420);
        double r2816422 = a;
        double r2816423 = z;
        double r2816424 = log(r2816423);
        double r2816425 = fma(r2816421, r2816422, r2816424);
        double r2816426 = 0.5;
        double r2816427 = fma(r2816421, r2816426, r2816420);
        double r2816428 = r2816425 - r2816427;
        double r2816429 = r2816419 + r2816428;
        return r2816429;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Derivation

  1. Initial program 0.3

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

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

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

    \[\leadsto \log \left(x + y\right) + \color{blue}{\mathsf{fma}\left(\log t, a - 0.5, \log z - t\right)}\]
  6. Taylor expanded around 0 0.3

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

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

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

Reproduce

herbie shell --seed 2019165 +o rules:numerics
(FPCore (x y z t a)
  :name "Numeric.SpecFunctions:logGammaL from math-functions-0.1.5.2"
  (+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))