Average Error: 0.1 → 0.1
Time: 6.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(b, a - 0.5, \mathsf{fma}\left(z, 1 - \log t, x + y\right) + \log t \cdot \left(\left(-z\right) + z\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(b, a - 0.5, \mathsf{fma}\left(z, 1 - \log t, x + y\right) + \log t \cdot \left(\left(-z\right) + z\right)\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r325674 = x;
        double r325675 = y;
        double r325676 = r325674 + r325675;
        double r325677 = z;
        double r325678 = r325676 + r325677;
        double r325679 = t;
        double r325680 = log(r325679);
        double r325681 = r325677 * r325680;
        double r325682 = r325678 - r325681;
        double r325683 = a;
        double r325684 = 0.5;
        double r325685 = r325683 - r325684;
        double r325686 = b;
        double r325687 = r325685 * r325686;
        double r325688 = r325682 + r325687;
        return r325688;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r325689 = b;
        double r325690 = a;
        double r325691 = 0.5;
        double r325692 = r325690 - r325691;
        double r325693 = z;
        double r325694 = 1.0;
        double r325695 = t;
        double r325696 = log(r325695);
        double r325697 = r325694 - r325696;
        double r325698 = x;
        double r325699 = y;
        double r325700 = r325698 + r325699;
        double r325701 = fma(r325693, r325697, r325700);
        double r325702 = -r325693;
        double r325703 = r325702 + r325693;
        double r325704 = r325696 * r325703;
        double r325705 = r325701 + r325704;
        double r325706 = fma(r325689, r325692, r325705);
        return r325706;
}

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

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

    \[\leadsto \mathsf{fma}\left(b, a - 0.5, \color{blue}{\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)\]
  6. Simplified0.1

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

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

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

Reproduce

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