Average Error: 0.1 → 0.1
Time: 21.9s
Precision: 64
\[x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right)\]
\[\mathsf{fma}\left(x, 0.5, y \cdot \left(\mathsf{fma}\left(2, \log \left(\sqrt[3]{z}\right), 1 - z\right) + \log \left(\sqrt[3]{z}\right)\right)\right)\]
x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right)
\mathsf{fma}\left(x, 0.5, y \cdot \left(\mathsf{fma}\left(2, \log \left(\sqrt[3]{z}\right), 1 - z\right) + \log \left(\sqrt[3]{z}\right)\right)\right)
double f(double x, double y, double z) {
        double r240679 = x;
        double r240680 = 0.5;
        double r240681 = r240679 * r240680;
        double r240682 = y;
        double r240683 = 1.0;
        double r240684 = z;
        double r240685 = r240683 - r240684;
        double r240686 = log(r240684);
        double r240687 = r240685 + r240686;
        double r240688 = r240682 * r240687;
        double r240689 = r240681 + r240688;
        return r240689;
}

double f(double x, double y, double z) {
        double r240690 = x;
        double r240691 = 0.5;
        double r240692 = y;
        double r240693 = 2.0;
        double r240694 = z;
        double r240695 = cbrt(r240694);
        double r240696 = log(r240695);
        double r240697 = 1.0;
        double r240698 = r240697 - r240694;
        double r240699 = fma(r240693, r240696, r240698);
        double r240700 = r240699 + r240696;
        double r240701 = r240692 * r240700;
        double r240702 = fma(r240690, r240691, r240701);
        return r240702;
}

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. Final simplification0.1

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

Reproduce

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