Average Error: 0.1 → 0.1
Time: 25.1s
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(1 - \log t, z, y + \mathsf{fma}\left(b, a - 0.5, x\right)\right)\]
\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b
\mathsf{fma}\left(1 - \log t, z, y + \mathsf{fma}\left(b, a - 0.5, x\right)\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r14119678 = x;
        double r14119679 = y;
        double r14119680 = r14119678 + r14119679;
        double r14119681 = z;
        double r14119682 = r14119680 + r14119681;
        double r14119683 = t;
        double r14119684 = log(r14119683);
        double r14119685 = r14119681 * r14119684;
        double r14119686 = r14119682 - r14119685;
        double r14119687 = a;
        double r14119688 = 0.5;
        double r14119689 = r14119687 - r14119688;
        double r14119690 = b;
        double r14119691 = r14119689 * r14119690;
        double r14119692 = r14119686 + r14119691;
        return r14119692;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r14119693 = 1.0;
        double r14119694 = t;
        double r14119695 = log(r14119694);
        double r14119696 = r14119693 - r14119695;
        double r14119697 = z;
        double r14119698 = y;
        double r14119699 = b;
        double r14119700 = a;
        double r14119701 = 0.5;
        double r14119702 = r14119700 - r14119701;
        double r14119703 = x;
        double r14119704 = fma(r14119699, r14119702, r14119703);
        double r14119705 = r14119698 + r14119704;
        double r14119706 = fma(r14119696, r14119697, r14119705);
        return r14119706;
}

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.3
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(1 - \log t, z, \mathsf{fma}\left(b, a - 0.5, x\right) + y\right)}\]
  3. Final simplification0.1

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

Reproduce

herbie shell --seed 2019179 +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)))