Average Error: 0.1 → 0.1
Time: 20.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(a - 0.5, b, z \cdot \left(1 - \log t\right)\right) + \left(x + y\right)\]
\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b
\mathsf{fma}\left(a - 0.5, b, z \cdot \left(1 - \log t\right)\right) + \left(x + y\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r301613 = x;
        double r301614 = y;
        double r301615 = r301613 + r301614;
        double r301616 = z;
        double r301617 = r301615 + r301616;
        double r301618 = t;
        double r301619 = log(r301618);
        double r301620 = r301616 * r301619;
        double r301621 = r301617 - r301620;
        double r301622 = a;
        double r301623 = 0.5;
        double r301624 = r301622 - r301623;
        double r301625 = b;
        double r301626 = r301624 * r301625;
        double r301627 = r301621 + r301626;
        return r301627;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r301628 = a;
        double r301629 = 0.5;
        double r301630 = r301628 - r301629;
        double r301631 = b;
        double r301632 = z;
        double r301633 = 1.0;
        double r301634 = t;
        double r301635 = log(r301634);
        double r301636 = r301633 - r301635;
        double r301637 = r301632 * r301636;
        double r301638 = fma(r301630, r301631, r301637);
        double r301639 = x;
        double r301640 = y;
        double r301641 = r301639 + r301640;
        double r301642 = r301638 + r301641;
        return r301642;
}

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(1 - \log t, z, \mathsf{fma}\left(b, a - 0.5, x\right) + y\right)}\]
  3. Using strategy rm
  4. Applied *-un-lft-identity0.1

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

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

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

    \[\leadsto \mathsf{fma}\left(1 - \log t, z, 1 \cdot \color{blue}{\mathsf{fma}\left(a - 0.5, b, y + x\right)}\right)\]
  8. Using strategy rm
  9. Applied fma-udef0.1

    \[\leadsto \color{blue}{\left(1 - \log t\right) \cdot z + 1 \cdot \mathsf{fma}\left(a - 0.5, b, y + x\right)}\]
  10. Using strategy rm
  11. Applied fma-udef0.1

    \[\leadsto \left(1 - \log t\right) \cdot z + 1 \cdot \color{blue}{\left(\left(a - 0.5\right) \cdot b + \left(y + x\right)\right)}\]
  12. Applied distribute-rgt-in0.1

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

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

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

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

Reproduce

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