Average Error: 0.1 → 0.1
Time: 51.3s
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(a - 0.5, b, z\right) - z \cdot \log t\right) + \left(y + x\right)\]
\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b
\left(\mathsf{fma}\left(a - 0.5, b, z\right) - z \cdot \log t\right) + \left(y + x\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r18272592 = x;
        double r18272593 = y;
        double r18272594 = r18272592 + r18272593;
        double r18272595 = z;
        double r18272596 = r18272594 + r18272595;
        double r18272597 = t;
        double r18272598 = log(r18272597);
        double r18272599 = r18272595 * r18272598;
        double r18272600 = r18272596 - r18272599;
        double r18272601 = a;
        double r18272602 = 0.5;
        double r18272603 = r18272601 - r18272602;
        double r18272604 = b;
        double r18272605 = r18272603 * r18272604;
        double r18272606 = r18272600 + r18272605;
        return r18272606;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r18272607 = a;
        double r18272608 = 0.5;
        double r18272609 = r18272607 - r18272608;
        double r18272610 = b;
        double r18272611 = z;
        double r18272612 = fma(r18272609, r18272610, r18272611);
        double r18272613 = t;
        double r18272614 = log(r18272613);
        double r18272615 = r18272611 * r18272614;
        double r18272616 = r18272612 - r18272615;
        double r18272617 = y;
        double r18272618 = x;
        double r18272619 = r18272617 + r18272618;
        double r18272620 = r18272616 + r18272619;
        return r18272620;
}

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. Using strategy rm
  3. Applied associate--l+0.1

    \[\leadsto \color{blue}{\left(\left(x + y\right) + \left(z - z \cdot \log t\right)\right)} + \left(a - 0.5\right) \cdot b\]
  4. Applied associate-+l+0.1

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

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

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

Reproduce

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