Average Error: 0.3 → 0.3
Time: 1.1m
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 r14900301 = x;
        double r14900302 = y;
        double r14900303 = r14900301 + r14900302;
        double r14900304 = log(r14900303);
        double r14900305 = z;
        double r14900306 = log(r14900305);
        double r14900307 = r14900304 + r14900306;
        double r14900308 = t;
        double r14900309 = r14900307 - r14900308;
        double r14900310 = a;
        double r14900311 = 0.5;
        double r14900312 = r14900310 - r14900311;
        double r14900313 = log(r14900308);
        double r14900314 = r14900312 * r14900313;
        double r14900315 = r14900309 + r14900314;
        return r14900315;
}

double f(double x, double y, double z, double t, double a) {
        double r14900316 = y;
        double r14900317 = x;
        double r14900318 = r14900316 + r14900317;
        double r14900319 = log(r14900318);
        double r14900320 = t;
        double r14900321 = log(r14900320);
        double r14900322 = a;
        double r14900323 = z;
        double r14900324 = log(r14900323);
        double r14900325 = fma(r14900321, r14900322, r14900324);
        double r14900326 = 0.5;
        double r14900327 = fma(r14900321, r14900326, r14900320);
        double r14900328 = r14900325 - r14900327;
        double r14900329 = r14900319 + r14900328;
        return r14900329;
}

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(\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"

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

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