Average Error: 0.1 → 0.1
Time: 13.4s
Precision: 64
\[x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right)\]
\[\mathsf{fma}\left(x, 0.5, y \cdot \left(2 \cdot \log \left(\sqrt[3]{z}\right) + \left(1 - z\right)\right) + \log \left({\left(\frac{1}{z}\right)}^{\frac{-1}{3}}\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 \left(2 \cdot \log \left(\sqrt[3]{z}\right) + \left(1 - z\right)\right) + \log \left({\left(\frac{1}{z}\right)}^{\frac{-1}{3}}\right) \cdot y\right)
double f(double x, double y, double z) {
        double r302661 = x;
        double r302662 = 0.5;
        double r302663 = r302661 * r302662;
        double r302664 = y;
        double r302665 = 1.0;
        double r302666 = z;
        double r302667 = r302665 - r302666;
        double r302668 = log(r302666);
        double r302669 = r302667 + r302668;
        double r302670 = r302664 * r302669;
        double r302671 = r302663 + r302670;
        return r302671;
}

double f(double x, double y, double z) {
        double r302672 = x;
        double r302673 = 0.5;
        double r302674 = y;
        double r302675 = 2.0;
        double r302676 = z;
        double r302677 = cbrt(r302676);
        double r302678 = log(r302677);
        double r302679 = r302675 * r302678;
        double r302680 = 1.0;
        double r302681 = r302680 - r302676;
        double r302682 = r302679 + r302681;
        double r302683 = r302674 * r302682;
        double r302684 = 1.0;
        double r302685 = r302684 / r302676;
        double r302686 = -0.3333333333333333;
        double r302687 = pow(r302685, r302686);
        double r302688 = log(r302687);
        double r302689 = r302688 * r302674;
        double r302690 = r302683 + r302689;
        double r302691 = fma(r302672, r302673, r302690);
        return r302691;
}

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 distribute-lft-in0.1

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

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

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

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

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

    \[\leadsto \mathsf{fma}\left(x, 0.5, \color{blue}{y \cdot \left(2 \cdot \log \left(\sqrt[3]{z}\right) + \left(1 - z\right)\right)} + \log \left(\sqrt[3]{z}\right) \cdot y\right)\]
  11. Taylor expanded around inf 0.1

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

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

Reproduce

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