Average Error: 0.1 → 0.1
Time: 5.8s
Precision: 64
\[x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right)\]
\[x \cdot 0.5 + \left(y \cdot \mathsf{fma}\left(2, \log \left(\sqrt[3]{z}\right), 1 - z\right) + \log \left({z}^{\frac{1}{3}}\right) \cdot y\right)\]
x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right)
x \cdot 0.5 + \left(y \cdot \mathsf{fma}\left(2, \log \left(\sqrt[3]{z}\right), 1 - z\right) + \log \left({z}^{\frac{1}{3}}\right) \cdot y\right)
double f(double x, double y, double z) {
        double r297856 = x;
        double r297857 = 0.5;
        double r297858 = r297856 * r297857;
        double r297859 = y;
        double r297860 = 1.0;
        double r297861 = z;
        double r297862 = r297860 - r297861;
        double r297863 = log(r297861);
        double r297864 = r297862 + r297863;
        double r297865 = r297859 * r297864;
        double r297866 = r297858 + r297865;
        return r297866;
}

double f(double x, double y, double z) {
        double r297867 = x;
        double r297868 = 0.5;
        double r297869 = r297867 * r297868;
        double r297870 = y;
        double r297871 = 2.0;
        double r297872 = z;
        double r297873 = cbrt(r297872);
        double r297874 = log(r297873);
        double r297875 = 1.0;
        double r297876 = r297875 - r297872;
        double r297877 = fma(r297871, r297874, r297876);
        double r297878 = r297870 * r297877;
        double r297879 = 0.3333333333333333;
        double r297880 = pow(r297872, r297879);
        double r297881 = log(r297880);
        double r297882 = r297881 * r297870;
        double r297883 = r297878 + r297882;
        double r297884 = r297869 + r297883;
        return r297884;
}

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. Using strategy rm
  3. Applied add-cube-cbrt0.1

    \[\leadsto x \cdot 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)\]
  4. Applied log-prod0.1

    \[\leadsto x \cdot 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)\]
  5. Applied associate-+r+0.1

    \[\leadsto x \cdot 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)}\]
  6. Simplified0.1

    \[\leadsto x \cdot 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)\]
  7. Using strategy rm
  8. Applied distribute-lft-in0.1

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

    \[\leadsto x \cdot 0.5 + \left(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)\]
  10. Final simplification0.1

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

Reproduce

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