Average Error: 0.1 → 0.1
Time: 6.9s
Precision: 64
\[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b\]
\[\left(\mathsf{fma}\left(z, 1 - \log t, x + y\right) + \log t \cdot \left(\left(-z\right) + z\right)\right) + \left(a - 0.5\right) \cdot b\]
\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b
\left(\mathsf{fma}\left(z, 1 - \log t, x + y\right) + \log t \cdot \left(\left(-z\right) + z\right)\right) + \left(a - 0.5\right) \cdot b
double f(double x, double y, double z, double t, double a, double b) {
        double r379602 = x;
        double r379603 = y;
        double r379604 = r379602 + r379603;
        double r379605 = z;
        double r379606 = r379604 + r379605;
        double r379607 = t;
        double r379608 = log(r379607);
        double r379609 = r379605 * r379608;
        double r379610 = r379606 - r379609;
        double r379611 = a;
        double r379612 = 0.5;
        double r379613 = r379611 - r379612;
        double r379614 = b;
        double r379615 = r379613 * r379614;
        double r379616 = r379610 + r379615;
        return r379616;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r379617 = z;
        double r379618 = 1.0;
        double r379619 = t;
        double r379620 = log(r379619);
        double r379621 = r379618 - r379620;
        double r379622 = x;
        double r379623 = y;
        double r379624 = r379622 + r379623;
        double r379625 = fma(r379617, r379621, r379624);
        double r379626 = -r379617;
        double r379627 = r379626 + r379617;
        double r379628 = r379620 * r379627;
        double r379629 = r379625 + r379628;
        double r379630 = a;
        double r379631 = 0.5;
        double r379632 = r379630 - r379631;
        double r379633 = b;
        double r379634 = r379632 * r379633;
        double r379635 = r379629 + r379634;
        return r379635;
}

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. Using strategy rm
  3. Applied add-sqr-sqrt32.1

    \[\leadsto \left(\color{blue}{\sqrt{\left(x + y\right) + z} \cdot \sqrt{\left(x + y\right) + z}} - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b\]
  4. Applied prod-diff32.1

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

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

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

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

Reproduce

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

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

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