Average Error: 0.3 → 0.3
Time: 45.4s
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 r4562857 = x;
        double r4562858 = y;
        double r4562859 = r4562857 + r4562858;
        double r4562860 = log(r4562859);
        double r4562861 = z;
        double r4562862 = log(r4562861);
        double r4562863 = r4562860 + r4562862;
        double r4562864 = t;
        double r4562865 = r4562863 - r4562864;
        double r4562866 = a;
        double r4562867 = 0.5;
        double r4562868 = r4562866 - r4562867;
        double r4562869 = log(r4562864);
        double r4562870 = r4562868 * r4562869;
        double r4562871 = r4562865 + r4562870;
        return r4562871;
}

double f(double x, double y, double z, double t, double a) {
        double r4562872 = x;
        double r4562873 = y;
        double r4562874 = r4562872 + r4562873;
        double r4562875 = log(r4562874);
        double r4562876 = a;
        double r4562877 = 0.5;
        double r4562878 = r4562876 - r4562877;
        double r4562879 = t;
        double r4562880 = log(r4562879);
        double r4562881 = z;
        double r4562882 = log(r4562881);
        double r4562883 = r4562882 - r4562879;
        double r4562884 = fma(r4562878, r4562880, r4562883);
        double r4562885 = r4562875 + r4562884;
        return r4562885;
}

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. 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 2019173 +o rules:numerics
(FPCore (x y z t a)
  :name "Numeric.SpecFunctions:logGammaL from math-functions-0.1.5.2"
  (+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))