Average Error: 0.3 → 0.3
Time: 11.0s
Precision: 64
\[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t\]
\[\mathsf{fma}\left(\log t, a - 0.5, \log \left(x + y\right)\right) + \left(\log z - t\right)\]
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t
\mathsf{fma}\left(\log t, a - 0.5, \log \left(x + y\right)\right) + \left(\log z - t\right)
double f(double x, double y, double z, double t, double a) {
        double r54056 = x;
        double r54057 = y;
        double r54058 = r54056 + r54057;
        double r54059 = log(r54058);
        double r54060 = z;
        double r54061 = log(r54060);
        double r54062 = r54059 + r54061;
        double r54063 = t;
        double r54064 = r54062 - r54063;
        double r54065 = a;
        double r54066 = 0.5;
        double r54067 = r54065 - r54066;
        double r54068 = log(r54063);
        double r54069 = r54067 * r54068;
        double r54070 = r54064 + r54069;
        return r54070;
}

double f(double x, double y, double z, double t, double a) {
        double r54071 = t;
        double r54072 = log(r54071);
        double r54073 = a;
        double r54074 = 0.5;
        double r54075 = r54073 - r54074;
        double r54076 = x;
        double r54077 = y;
        double r54078 = r54076 + r54077;
        double r54079 = log(r54078);
        double r54080 = fma(r54072, r54075, r54079);
        double r54081 = z;
        double r54082 = log(r54081);
        double r54083 = r54082 - r54071;
        double r54084 = r54080 + r54083;
        return r54084;
}

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

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

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

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

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

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

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

Reproduce

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