Average Error: 0.3 → 0.3
Time: 10.8s
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 r43157 = x;
        double r43158 = y;
        double r43159 = r43157 + r43158;
        double r43160 = log(r43159);
        double r43161 = z;
        double r43162 = log(r43161);
        double r43163 = r43160 + r43162;
        double r43164 = t;
        double r43165 = r43163 - r43164;
        double r43166 = a;
        double r43167 = 0.5;
        double r43168 = r43166 - r43167;
        double r43169 = log(r43164);
        double r43170 = r43168 * r43169;
        double r43171 = r43165 + r43170;
        return r43171;
}

double f(double x, double y, double z, double t, double a) {
        double r43172 = t;
        double r43173 = log(r43172);
        double r43174 = a;
        double r43175 = 0.5;
        double r43176 = r43174 - r43175;
        double r43177 = x;
        double r43178 = y;
        double r43179 = r43177 + r43178;
        double r43180 = log(r43179);
        double r43181 = fma(r43173, r43176, r43180);
        double r43182 = z;
        double r43183 = log(r43182);
        double r43184 = r43183 - r43172;
        double r43185 = r43181 + r43184;
        return r43185;
}

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))))