Average Error: 0.1 → 0.1
Time: 24.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(\frac{2}{3}, \log z, 1 - z\right) + \left(\log \left(\sqrt[3]{{z}^{\frac{2}{3}}}\right) \cdot y + \log \left(\sqrt[3]{\sqrt[3]{z}}\right) \cdot y\right)\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(\frac{2}{3}, \log z, 1 - z\right) + \left(\log \left(\sqrt[3]{{z}^{\frac{2}{3}}}\right) \cdot y + \log \left(\sqrt[3]{\sqrt[3]{z}}\right) \cdot y\right)\right)
double f(double x, double y, double z) {
        double r163644 = x;
        double r163645 = 0.5;
        double r163646 = r163644 * r163645;
        double r163647 = y;
        double r163648 = 1.0;
        double r163649 = z;
        double r163650 = r163648 - r163649;
        double r163651 = log(r163649);
        double r163652 = r163650 + r163651;
        double r163653 = r163647 * r163652;
        double r163654 = r163646 + r163653;
        return r163654;
}

double f(double x, double y, double z) {
        double r163655 = x;
        double r163656 = 0.5;
        double r163657 = y;
        double r163658 = 0.6666666666666666;
        double r163659 = z;
        double r163660 = log(r163659);
        double r163661 = 1.0;
        double r163662 = r163661 - r163659;
        double r163663 = fma(r163658, r163660, r163662);
        double r163664 = r163657 * r163663;
        double r163665 = pow(r163659, r163658);
        double r163666 = cbrt(r163665);
        double r163667 = log(r163666);
        double r163668 = r163667 * r163657;
        double r163669 = cbrt(r163659);
        double r163670 = cbrt(r163669);
        double r163671 = log(r163670);
        double r163672 = r163671 * r163657;
        double r163673 = r163668 + r163672;
        double r163674 = r163664 + r163673;
        double r163675 = fma(r163655, r163656, r163674);
        return r163675;
}

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, \color{blue}{y \cdot \mathsf{fma}\left(\frac{2}{3}, \log z, 1 - z\right)} + y \cdot \log \left(\sqrt[3]{z}\right)\right)\]
  11. Using strategy rm
  12. Applied add-cube-cbrt0.1

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

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

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

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

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

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

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

Reproduce

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