Average Error: 0.1 → 0.1
Time: 6.7s
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)\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)\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r478690 = x;
        double r478691 = y;
        double r478692 = r478690 + r478691;
        double r478693 = z;
        double r478694 = r478692 + r478693;
        double r478695 = t;
        double r478696 = log(r478695);
        double r478697 = r478693 * r478696;
        double r478698 = r478694 - r478697;
        double r478699 = a;
        double r478700 = 0.5;
        double r478701 = r478699 - r478700;
        double r478702 = b;
        double r478703 = r478701 * r478702;
        double r478704 = r478698 + r478703;
        return r478704;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r478705 = b;
        double r478706 = a;
        double r478707 = 0.5;
        double r478708 = r478706 - r478707;
        double r478709 = z;
        double r478710 = 1.0;
        double r478711 = t;
        double r478712 = log(r478711);
        double r478713 = r478710 - r478712;
        double r478714 = x;
        double r478715 = y;
        double r478716 = r478714 + r478715;
        double r478717 = fma(r478709, r478713, r478716);
        double r478718 = fma(r478705, r478708, r478717);
        return r478718;
}

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, \left(\left(x + y\right) + z\right) - z \cdot \log t\right)}\]
  3. Taylor expanded around 0 0.1

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

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

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

Reproduce

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