Average Error: 0.1 → 0.1
Time: 31.2s
Precision: 64
\[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b\]
\[\mathsf{fma}\left(b, a - 0.5, \mathsf{fma}\left(\left(1 - \log \left(\sqrt{t}\right)\right) - \log \left(\sqrt{t}\right), z, y\right)\right) + x\]
\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b
\mathsf{fma}\left(b, a - 0.5, \mathsf{fma}\left(\left(1 - \log \left(\sqrt{t}\right)\right) - \log \left(\sqrt{t}\right), z, y\right)\right) + x
double f(double x, double y, double z, double t, double a, double b) {
        double r287767 = x;
        double r287768 = y;
        double r287769 = r287767 + r287768;
        double r287770 = z;
        double r287771 = r287769 + r287770;
        double r287772 = t;
        double r287773 = log(r287772);
        double r287774 = r287770 * r287773;
        double r287775 = r287771 - r287774;
        double r287776 = a;
        double r287777 = 0.5;
        double r287778 = r287776 - r287777;
        double r287779 = b;
        double r287780 = r287778 * r287779;
        double r287781 = r287775 + r287780;
        return r287781;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r287782 = b;
        double r287783 = a;
        double r287784 = 0.5;
        double r287785 = r287783 - r287784;
        double r287786 = 1.0;
        double r287787 = t;
        double r287788 = sqrt(r287787);
        double r287789 = log(r287788);
        double r287790 = r287786 - r287789;
        double r287791 = r287790 - r287789;
        double r287792 = z;
        double r287793 = y;
        double r287794 = fma(r287791, r287792, r287793);
        double r287795 = fma(r287782, r287785, r287794);
        double r287796 = x;
        double r287797 = r287795 + r287796;
        return r287797;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Bits error versus b

Target

Original0.1
Target0.4
Herbie0.1
\[\left(\left(x + y\right) + \frac{\left(1 - {\left(\log t\right)}^{2}\right) \cdot z}{1 + \log t}\right) + \left(a - 0.5\right) \cdot b\]

Derivation

  1. Initial program 0.1

    \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b\]
  2. Simplified0.1

    \[\leadsto \color{blue}{\mathsf{fma}\left(b, a - 0.5, \mathsf{fma}\left(1 - \log t, z, y\right)\right) + x}\]
  3. Using strategy rm
  4. Applied add-sqr-sqrt0.1

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

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

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

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

Reproduce

herbie shell --seed 2019199 +o rules:numerics
(FPCore (x y z t a b)
  :name "Numeric.SpecFunctions:logBeta from math-functions-0.1.5.2, A"

  :herbie-target
  (+ (+ (+ x y) (/ (* (- 1.0 (pow (log t) 2.0)) z) (+ 1.0 (log t)))) (* (- a 0.5) b))

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