Average Error: 0.1 → 0.1
Time: 5.6s
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 r274127 = x;
        double r274128 = 0.5;
        double r274129 = r274127 * r274128;
        double r274130 = y;
        double r274131 = 1.0;
        double r274132 = z;
        double r274133 = r274131 - r274132;
        double r274134 = log(r274132);
        double r274135 = r274133 + r274134;
        double r274136 = r274130 * r274135;
        double r274137 = r274129 + r274136;
        return r274137;
}

double f(double x, double y, double z) {
        double r274138 = x;
        double r274139 = 0.5;
        double r274140 = r274138 * r274139;
        double r274141 = y;
        double r274142 = 2.0;
        double r274143 = z;
        double r274144 = cbrt(r274143);
        double r274145 = log(r274144);
        double r274146 = 1.0;
        double r274147 = r274146 - r274143;
        double r274148 = fma(r274142, r274145, r274147);
        double r274149 = r274141 * r274148;
        double r274150 = 0.3333333333333333;
        double r274151 = pow(r274143, r274150);
        double r274152 = log(r274151);
        double r274153 = r274152 * r274141;
        double r274154 = r274149 + r274153;
        double r274155 = r274140 + r274154;
        return r274155;
}

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 2020056 +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)))))