Average Error: 0.3 → 0.3
Time: 42.8s
Precision: 64
\[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t\]
\[\log \left(x + y\right) + \mathsf{fma}\left(a - 0.5, \log t, \log z - t\right)\]
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t
\log \left(x + y\right) + \mathsf{fma}\left(a - 0.5, \log t, \log z - t\right)
double f(double x, double y, double z, double t, double a) {
        double r88878200 = x;
        double r88878201 = y;
        double r88878202 = r88878200 + r88878201;
        double r88878203 = log(r88878202);
        double r88878204 = z;
        double r88878205 = log(r88878204);
        double r88878206 = r88878203 + r88878205;
        double r88878207 = t;
        double r88878208 = r88878206 - r88878207;
        double r88878209 = a;
        double r88878210 = 0.5;
        double r88878211 = r88878209 - r88878210;
        double r88878212 = log(r88878207);
        double r88878213 = r88878211 * r88878212;
        double r88878214 = r88878208 + r88878213;
        return r88878214;
}

double f(double x, double y, double z, double t, double a) {
        double r88878215 = x;
        double r88878216 = y;
        double r88878217 = r88878215 + r88878216;
        double r88878218 = log(r88878217);
        double r88878219 = a;
        double r88878220 = 0.5;
        double r88878221 = r88878219 - r88878220;
        double r88878222 = t;
        double r88878223 = log(r88878222);
        double r88878224 = z;
        double r88878225 = log(r88878224);
        double r88878226 = r88878225 - r88878222;
        double r88878227 = fma(r88878221, r88878223, r88878226);
        double r88878228 = r88878218 + r88878227;
        return r88878228;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original0.3
Target0.3
Herbie0.3
\[\log \left(x + y\right) + \left(\left(\log z - t\right) + \left(a - 0.5\right) \cdot \log t\right)\]

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(a - 0.5, \log t, \log z - t\right)}\]
  6. Final simplification0.3

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

Reproduce

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

  :herbie-target
  (+ (log (+ x y)) (+ (- (log z) t) (* (- a 0.5) (log t))))

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