Average Error: 0.3 → 0.3
Time: 41.2s
Precision: 64
\[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t\]
\[\left(\left(\log \left(y + x\right) + \left(\log \left(\sqrt{z}\right) - \mathsf{fma}\left(0.5 - a, \log t, t\right)\right)\right) + \log \left(\sqrt[3]{\sqrt{z}}\right)\right) + \log \left(\sqrt[3]{\sqrt{z}} \cdot \sqrt[3]{\sqrt{z}}\right)\]
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t
\left(\left(\log \left(y + x\right) + \left(\log \left(\sqrt{z}\right) - \mathsf{fma}\left(0.5 - a, \log t, t\right)\right)\right) + \log \left(\sqrt[3]{\sqrt{z}}\right)\right) + \log \left(\sqrt[3]{\sqrt{z}} \cdot \sqrt[3]{\sqrt{z}}\right)
double f(double x, double y, double z, double t, double a) {
        double r14139836 = x;
        double r14139837 = y;
        double r14139838 = r14139836 + r14139837;
        double r14139839 = log(r14139838);
        double r14139840 = z;
        double r14139841 = log(r14139840);
        double r14139842 = r14139839 + r14139841;
        double r14139843 = t;
        double r14139844 = r14139842 - r14139843;
        double r14139845 = a;
        double r14139846 = 0.5;
        double r14139847 = r14139845 - r14139846;
        double r14139848 = log(r14139843);
        double r14139849 = r14139847 * r14139848;
        double r14139850 = r14139844 + r14139849;
        return r14139850;
}

double f(double x, double y, double z, double t, double a) {
        double r14139851 = y;
        double r14139852 = x;
        double r14139853 = r14139851 + r14139852;
        double r14139854 = log(r14139853);
        double r14139855 = z;
        double r14139856 = sqrt(r14139855);
        double r14139857 = log(r14139856);
        double r14139858 = 0.5;
        double r14139859 = a;
        double r14139860 = r14139858 - r14139859;
        double r14139861 = t;
        double r14139862 = log(r14139861);
        double r14139863 = fma(r14139860, r14139862, r14139861);
        double r14139864 = r14139857 - r14139863;
        double r14139865 = r14139854 + r14139864;
        double r14139866 = cbrt(r14139856);
        double r14139867 = log(r14139866);
        double r14139868 = r14139865 + r14139867;
        double r14139869 = r14139866 * r14139866;
        double r14139870 = log(r14139869);
        double r14139871 = r14139868 + r14139870;
        return r14139871;
}

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}{\left(\log z - \mathsf{fma}\left(0.5 - a, \log t, t\right)\right) + \log \left(y + x\right)}\]
  3. Using strategy rm
  4. Applied add-sqr-sqrt0.3

    \[\leadsto \left(\log \color{blue}{\left(\sqrt{z} \cdot \sqrt{z}\right)} - \mathsf{fma}\left(0.5 - a, \log t, t\right)\right) + \log \left(y + x\right)\]
  5. Applied log-prod0.3

    \[\leadsto \left(\color{blue}{\left(\log \left(\sqrt{z}\right) + \log \left(\sqrt{z}\right)\right)} - \mathsf{fma}\left(0.5 - a, \log t, t\right)\right) + \log \left(y + x\right)\]
  6. Applied associate--l+0.3

    \[\leadsto \color{blue}{\left(\log \left(\sqrt{z}\right) + \left(\log \left(\sqrt{z}\right) - \mathsf{fma}\left(0.5 - a, \log t, t\right)\right)\right)} + \log \left(y + x\right)\]
  7. Applied associate-+l+0.3

    \[\leadsto \color{blue}{\log \left(\sqrt{z}\right) + \left(\left(\log \left(\sqrt{z}\right) - \mathsf{fma}\left(0.5 - a, \log t, t\right)\right) + \log \left(y + x\right)\right)}\]
  8. Using strategy rm
  9. Applied add-cube-cbrt0.3

    \[\leadsto \log \color{blue}{\left(\left(\sqrt[3]{\sqrt{z}} \cdot \sqrt[3]{\sqrt{z}}\right) \cdot \sqrt[3]{\sqrt{z}}\right)} + \left(\left(\log \left(\sqrt{z}\right) - \mathsf{fma}\left(0.5 - a, \log t, t\right)\right) + \log \left(y + x\right)\right)\]
  10. Applied log-prod0.3

    \[\leadsto \color{blue}{\left(\log \left(\sqrt[3]{\sqrt{z}} \cdot \sqrt[3]{\sqrt{z}}\right) + \log \left(\sqrt[3]{\sqrt{z}}\right)\right)} + \left(\left(\log \left(\sqrt{z}\right) - \mathsf{fma}\left(0.5 - a, \log t, t\right)\right) + \log \left(y + x\right)\right)\]
  11. Applied associate-+l+0.3

    \[\leadsto \color{blue}{\log \left(\sqrt[3]{\sqrt{z}} \cdot \sqrt[3]{\sqrt{z}}\right) + \left(\log \left(\sqrt[3]{\sqrt{z}}\right) + \left(\left(\log \left(\sqrt{z}\right) - \mathsf{fma}\left(0.5 - a, \log t, t\right)\right) + \log \left(y + x\right)\right)\right)}\]
  12. Final simplification0.3

    \[\leadsto \left(\left(\log \left(y + x\right) + \left(\log \left(\sqrt{z}\right) - \mathsf{fma}\left(0.5 - a, \log t, t\right)\right)\right) + \log \left(\sqrt[3]{\sqrt{z}}\right)\right) + \log \left(\sqrt[3]{\sqrt{z}} \cdot \sqrt[3]{\sqrt{z}}\right)\]

Reproduce

herbie shell --seed 2019158 +o rules:numerics
(FPCore (x y z t a)
  :name "Numeric.SpecFunctions:logGammaL from math-functions-0.1.5.2"

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

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