Average Error: 0.3 → 0.3
Time: 38.0s
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 r187955 = x;
        double r187956 = y;
        double r187957 = r187955 + r187956;
        double r187958 = log(r187957);
        double r187959 = z;
        double r187960 = log(r187959);
        double r187961 = r187958 + r187960;
        double r187962 = t;
        double r187963 = r187961 - r187962;
        double r187964 = a;
        double r187965 = 0.5;
        double r187966 = r187964 - r187965;
        double r187967 = log(r187962);
        double r187968 = r187966 * r187967;
        double r187969 = r187963 + r187968;
        return r187969;
}

double f(double x, double y, double z, double t, double a) {
        double r187970 = x;
        double r187971 = y;
        double r187972 = r187970 + r187971;
        double r187973 = log(r187972);
        double r187974 = a;
        double r187975 = 0.5;
        double r187976 = r187974 - r187975;
        double r187977 = t;
        double r187978 = log(r187977);
        double r187979 = z;
        double r187980 = log(r187979);
        double r187981 = r187980 - r187977;
        double r187982 = fma(r187976, r187978, r187981);
        double r187983 = r187973 + r187982;
        return r187983;
}

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