Average Error: 0.3 → 0.3
Time: 37.4s
Precision: 64
\[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t\]
\[\left(\log \left(y + x\right) - \mathsf{fma}\left(0.5 - a, \log t, t\right)\right) + \log z\]
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t
\left(\log \left(y + x\right) - \mathsf{fma}\left(0.5 - a, \log t, t\right)\right) + \log z
double f(double x, double y, double z, double t, double a) {
        double r20189304 = x;
        double r20189305 = y;
        double r20189306 = r20189304 + r20189305;
        double r20189307 = log(r20189306);
        double r20189308 = z;
        double r20189309 = log(r20189308);
        double r20189310 = r20189307 + r20189309;
        double r20189311 = t;
        double r20189312 = r20189310 - r20189311;
        double r20189313 = a;
        double r20189314 = 0.5;
        double r20189315 = r20189313 - r20189314;
        double r20189316 = log(r20189311);
        double r20189317 = r20189315 * r20189316;
        double r20189318 = r20189312 + r20189317;
        return r20189318;
}

double f(double x, double y, double z, double t, double a) {
        double r20189319 = y;
        double r20189320 = x;
        double r20189321 = r20189319 + r20189320;
        double r20189322 = log(r20189321);
        double r20189323 = 0.5;
        double r20189324 = a;
        double r20189325 = r20189323 - r20189324;
        double r20189326 = t;
        double r20189327 = log(r20189326);
        double r20189328 = fma(r20189325, r20189327, r20189326);
        double r20189329 = r20189322 - r20189328;
        double r20189330 = z;
        double r20189331 = log(r20189330);
        double r20189332 = r20189329 + r20189331;
        return r20189332;
}

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

    \[\leadsto \color{blue}{\left(\log z - \mathsf{fma}\left(0.5 - a, \log t, t\right)\right) + \log \left(y + x\right)}\]
  3. Using strategy rm
  4. Applied sub-neg0.3

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

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

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

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

Reproduce

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