Average Error: 0.3 → 0.3
Time: 11.4s
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 r331086 = x;
        double r331087 = y;
        double r331088 = r331086 + r331087;
        double r331089 = log(r331088);
        double r331090 = z;
        double r331091 = log(r331090);
        double r331092 = r331089 + r331091;
        double r331093 = t;
        double r331094 = r331092 - r331093;
        double r331095 = a;
        double r331096 = 0.5;
        double r331097 = r331095 - r331096;
        double r331098 = log(r331093);
        double r331099 = r331097 * r331098;
        double r331100 = r331094 + r331099;
        return r331100;
}

double f(double x, double y, double z, double t, double a) {
        double r331101 = t;
        double r331102 = log(r331101);
        double r331103 = a;
        double r331104 = 0.5;
        double r331105 = r331103 - r331104;
        double r331106 = x;
        double r331107 = y;
        double r331108 = r331106 + r331107;
        double r331109 = log(r331108);
        double r331110 = fma(r331102, r331105, r331109);
        double r331111 = z;
        double r331112 = log(r331111);
        double r331113 = r331112 - r331101;
        double r331114 = r331110 + r331113;
        return r331114;
}

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

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

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