Average Error: 0.1 → 0.1
Time: 5.9s
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 r371557 = x;
        double r371558 = y;
        double r371559 = r371557 + r371558;
        double r371560 = z;
        double r371561 = r371559 + r371560;
        double r371562 = t;
        double r371563 = log(r371562);
        double r371564 = r371560 * r371563;
        double r371565 = r371561 - r371564;
        double r371566 = a;
        double r371567 = 0.5;
        double r371568 = r371566 - r371567;
        double r371569 = b;
        double r371570 = r371568 * r371569;
        double r371571 = r371565 + r371570;
        return r371571;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r371572 = b;
        double r371573 = a;
        double r371574 = 0.5;
        double r371575 = r371573 - r371574;
        double r371576 = z;
        double r371577 = 1.0;
        double r371578 = t;
        double r371579 = log(r371578);
        double r371580 = r371577 - r371579;
        double r371581 = x;
        double r371582 = y;
        double r371583 = r371581 + r371582;
        double r371584 = fma(r371576, r371580, r371583);
        double r371585 = fma(r371572, r371575, r371584);
        return r371585;
}

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. 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 2020025 +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)))