Average Error: 0.1 → 0.1
Time: 6.2s
Precision: 64
\[x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right)\]
\[x \cdot 0.5 + \mathsf{fma}\left(y, \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 + \mathsf{fma}\left(y, \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 r277545 = x;
        double r277546 = 0.5;
        double r277547 = r277545 * r277546;
        double r277548 = y;
        double r277549 = 1.0;
        double r277550 = z;
        double r277551 = r277549 - r277550;
        double r277552 = log(r277550);
        double r277553 = r277551 + r277552;
        double r277554 = r277548 * r277553;
        double r277555 = r277547 + r277554;
        return r277555;
}

double f(double x, double y, double z) {
        double r277556 = x;
        double r277557 = 0.5;
        double r277558 = r277556 * r277557;
        double r277559 = y;
        double r277560 = 2.0;
        double r277561 = z;
        double r277562 = cbrt(r277561);
        double r277563 = log(r277562);
        double r277564 = 1.0;
        double r277565 = r277564 - r277561;
        double r277566 = fma(r277560, r277563, r277565);
        double r277567 = 0.3333333333333333;
        double r277568 = pow(r277561, r277567);
        double r277569 = log(r277568);
        double r277570 = r277569 * r277559;
        double r277571 = fma(r277559, r277566, r277570);
        double r277572 = r277558 + r277571;
        return r277572;
}

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. Using strategy rm
  11. Applied fma-def0.1

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

    \[\leadsto x \cdot 0.5 + \mathsf{fma}\left(y, \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 2020060 +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)))))