Average Error: 0.3 → 0.3
Time: 30.1s
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 r207765 = x;
        double r207766 = y;
        double r207767 = r207765 + r207766;
        double r207768 = log(r207767);
        double r207769 = z;
        double r207770 = log(r207769);
        double r207771 = r207768 + r207770;
        double r207772 = t;
        double r207773 = r207771 - r207772;
        double r207774 = a;
        double r207775 = 0.5;
        double r207776 = r207774 - r207775;
        double r207777 = log(r207772);
        double r207778 = r207776 * r207777;
        double r207779 = r207773 + r207778;
        return r207779;
}

double f(double x, double y, double z, double t, double a) {
        double r207780 = x;
        double r207781 = y;
        double r207782 = r207780 + r207781;
        double r207783 = log(r207782);
        double r207784 = a;
        double r207785 = 0.5;
        double r207786 = r207784 - r207785;
        double r207787 = t;
        double r207788 = log(r207787);
        double r207789 = z;
        double r207790 = log(r207789);
        double r207791 = r207790 - r207787;
        double r207792 = fma(r207786, r207788, r207791);
        double r207793 = r207783 + r207792;
        return r207793;
}

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