Average Error: 0.1 → 0.1
Time: 6.0s
Precision: 64
\[x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right)\]
\[\mathsf{fma}\left(x, 0.5, y \cdot \mathsf{fma}\left(2, \log \left(\sqrt[3]{z}\right), 1 - z\right) + \log \left(\sqrt[3]{z}\right) \cdot y\right)\]
x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right)
\mathsf{fma}\left(x, 0.5, y \cdot \mathsf{fma}\left(2, \log \left(\sqrt[3]{z}\right), 1 - z\right) + \log \left(\sqrt[3]{z}\right) \cdot y\right)
double f(double x, double y, double z) {
        double r248452 = x;
        double r248453 = 0.5;
        double r248454 = r248452 * r248453;
        double r248455 = y;
        double r248456 = 1.0;
        double r248457 = z;
        double r248458 = r248456 - r248457;
        double r248459 = log(r248457);
        double r248460 = r248458 + r248459;
        double r248461 = r248455 * r248460;
        double r248462 = r248454 + r248461;
        return r248462;
}

double f(double x, double y, double z) {
        double r248463 = x;
        double r248464 = 0.5;
        double r248465 = y;
        double r248466 = 2.0;
        double r248467 = z;
        double r248468 = cbrt(r248467);
        double r248469 = log(r248468);
        double r248470 = 1.0;
        double r248471 = r248470 - r248467;
        double r248472 = fma(r248466, r248469, r248471);
        double r248473 = r248465 * r248472;
        double r248474 = r248469 * r248465;
        double r248475 = r248473 + r248474;
        double r248476 = fma(r248463, r248464, r248475);
        return r248476;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original0.1
Target0.1
Herbie0.1
\[\left(y + 0.5 \cdot x\right) - y \cdot \left(z - \log z\right)\]

Derivation

  1. Initial program 0.1

    \[x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right)\]
  2. Simplified0.1

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, 0.5, y \cdot \left(\left(1 - z\right) + \log z\right)\right)}\]
  3. Using strategy rm
  4. Applied add-cube-cbrt0.1

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

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

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

    \[\leadsto \mathsf{fma}\left(x, 0.5, y \cdot \left(\color{blue}{\mathsf{fma}\left(2, \log \left(\sqrt[3]{z}\right), 1 - z\right)} + \log \left(\sqrt[3]{z}\right)\right)\right)\]
  8. Using strategy rm
  9. Applied distribute-lft-in0.1

    \[\leadsto \mathsf{fma}\left(x, 0.5, \color{blue}{y \cdot \mathsf{fma}\left(2, \log \left(\sqrt[3]{z}\right), 1 - z\right) + y \cdot \log \left(\sqrt[3]{z}\right)}\right)\]
  10. Simplified0.1

    \[\leadsto \mathsf{fma}\left(x, 0.5, y \cdot \mathsf{fma}\left(2, \log \left(\sqrt[3]{z}\right), 1 - z\right) + \color{blue}{\log \left({z}^{\frac{1}{3}}\right) \cdot y}\right)\]
  11. Using strategy rm
  12. Applied unpow1/30.1

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

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

Reproduce

herbie shell --seed 2020024 +o rules:numerics
(FPCore (x y z)
  :name "System.Random.MWC.Distributions:gamma from mwc-random-0.13.3.2"
  :precision binary64

  :herbie-target
  (- (+ y (* 0.5 x)) (* y (- z (log z))))

  (+ (* x 0.5) (* y (+ (- 1 z) (log z)))))