Average Error: 0.1 → 0.1
Time: 6.2s
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 \left(\sqrt{t}\right), x + y\right) - z \cdot \log \left(\sqrt{t}\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 \left(\sqrt{t}\right), x + y\right) - z \cdot \log \left(\sqrt{t}\right)\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r364327 = x;
        double r364328 = y;
        double r364329 = r364327 + r364328;
        double r364330 = z;
        double r364331 = r364329 + r364330;
        double r364332 = t;
        double r364333 = log(r364332);
        double r364334 = r364330 * r364333;
        double r364335 = r364331 - r364334;
        double r364336 = a;
        double r364337 = 0.5;
        double r364338 = r364336 - r364337;
        double r364339 = b;
        double r364340 = r364338 * r364339;
        double r364341 = r364335 + r364340;
        return r364341;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r364342 = b;
        double r364343 = a;
        double r364344 = 0.5;
        double r364345 = r364343 - r364344;
        double r364346 = z;
        double r364347 = 1.0;
        double r364348 = t;
        double r364349 = sqrt(r364348);
        double r364350 = log(r364349);
        double r364351 = r364347 - r364350;
        double r364352 = x;
        double r364353 = y;
        double r364354 = r364352 + r364353;
        double r364355 = fma(r364346, r364351, r364354);
        double r364356 = r364346 * r364350;
        double r364357 = r364355 - r364356;
        double r364358 = fma(r364342, r364345, r364357);
        return r364358;
}

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-sqrt0.1

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

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

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

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

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

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

Reproduce

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