Average Error: 0.3 → 0.3
Time: 38.4s
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 r307626 = x;
        double r307627 = y;
        double r307628 = r307626 + r307627;
        double r307629 = log(r307628);
        double r307630 = z;
        double r307631 = log(r307630);
        double r307632 = r307629 + r307631;
        double r307633 = t;
        double r307634 = r307632 - r307633;
        double r307635 = a;
        double r307636 = 0.5;
        double r307637 = r307635 - r307636;
        double r307638 = log(r307633);
        double r307639 = r307637 * r307638;
        double r307640 = r307634 + r307639;
        return r307640;
}

double f(double x, double y, double z, double t, double a) {
        double r307641 = x;
        double r307642 = y;
        double r307643 = r307641 + r307642;
        double r307644 = log(r307643);
        double r307645 = a;
        double r307646 = 0.5;
        double r307647 = r307645 - r307646;
        double r307648 = t;
        double r307649 = log(r307648);
        double r307650 = z;
        double r307651 = log(r307650);
        double r307652 = r307651 - r307648;
        double r307653 = fma(r307647, r307649, r307652);
        double r307654 = r307644 + r307653;
        return r307654;
}

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 2019303 +o rules:numerics
(FPCore (x y z t a)
  :name "Numeric.SpecFunctions:logGammaL from math-functions-0.1.5.2"
  :precision binary64

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

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