Average Error: 0.1 → 0.1
Time: 22.0s
Precision: 64
\[x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right)\]
\[\mathsf{fma}\left(y, \left(\left(1 - z\right) + \log \left({z}^{\frac{1}{3}}\right)\right) + \log \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right), 0.5 \cdot x\right)\]
x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right)
\mathsf{fma}\left(y, \left(\left(1 - z\right) + \log \left({z}^{\frac{1}{3}}\right)\right) + \log \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right), 0.5 \cdot x\right)
double f(double x, double y, double z) {
        double r10834788 = x;
        double r10834789 = 0.5;
        double r10834790 = r10834788 * r10834789;
        double r10834791 = y;
        double r10834792 = 1.0;
        double r10834793 = z;
        double r10834794 = r10834792 - r10834793;
        double r10834795 = log(r10834793);
        double r10834796 = r10834794 + r10834795;
        double r10834797 = r10834791 * r10834796;
        double r10834798 = r10834790 + r10834797;
        return r10834798;
}

double f(double x, double y, double z) {
        double r10834799 = y;
        double r10834800 = 1.0;
        double r10834801 = z;
        double r10834802 = r10834800 - r10834801;
        double r10834803 = 0.3333333333333333;
        double r10834804 = pow(r10834801, r10834803);
        double r10834805 = log(r10834804);
        double r10834806 = r10834802 + r10834805;
        double r10834807 = cbrt(r10834801);
        double r10834808 = r10834807 * r10834807;
        double r10834809 = log(r10834808);
        double r10834810 = r10834806 + r10834809;
        double r10834811 = 0.5;
        double r10834812 = x;
        double r10834813 = r10834811 * r10834812;
        double r10834814 = fma(r10834799, r10834810, r10834813);
        return r10834814;
}

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(y, \log z + \left(1 - z\right), x \cdot 0.5\right)}\]
  3. Using strategy rm
  4. Applied add-cube-cbrt0.1

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

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

    \[\leadsto \mathsf{fma}\left(y, \color{blue}{\log \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) + \left(\log \left(\sqrt[3]{z}\right) + \left(1 - z\right)\right)}, x \cdot 0.5\right)\]
  7. Using strategy rm
  8. Applied pow1/30.1

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

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

Reproduce

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

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

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