Average Error: 0.1 → 0.1
Time: 13.4s
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(2 \cdot \log \left(\sqrt[3]{z}\right) + \left(1 - z\right)\right) + y \cdot \log \left({\left(\frac{1}{z}\right)}^{\frac{-1}{3}}\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(2 \cdot \log \left(\sqrt[3]{z}\right) + \left(1 - z\right)\right) + y \cdot \log \left({\left(\frac{1}{z}\right)}^{\frac{-1}{3}}\right)\right)
double f(double x, double y, double z) {
        double r391743 = x;
        double r391744 = 0.5;
        double r391745 = r391743 * r391744;
        double r391746 = y;
        double r391747 = 1.0;
        double r391748 = z;
        double r391749 = r391747 - r391748;
        double r391750 = log(r391748);
        double r391751 = r391749 + r391750;
        double r391752 = r391746 * r391751;
        double r391753 = r391745 + r391752;
        return r391753;
}

double f(double x, double y, double z) {
        double r391754 = x;
        double r391755 = 0.5;
        double r391756 = y;
        double r391757 = 2.0;
        double r391758 = z;
        double r391759 = cbrt(r391758);
        double r391760 = log(r391759);
        double r391761 = r391757 * r391760;
        double r391762 = 1.0;
        double r391763 = r391762 - r391758;
        double r391764 = r391761 + r391763;
        double r391765 = r391756 * r391764;
        double r391766 = 1.0;
        double r391767 = r391766 / r391758;
        double r391768 = -0.3333333333333333;
        double r391769 = pow(r391767, r391768);
        double r391770 = log(r391769);
        double r391771 = r391756 * r391770;
        double r391772 = r391765 + r391771;
        double r391773 = fma(r391754, r391755, r391772);
        return r391773;
}

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 distribute-lft-in0.1

    \[\leadsto \mathsf{fma}\left(x, 0.5, \color{blue}{y \cdot \left(1 - z\right) + y \cdot \log z}\right)\]
  5. Using strategy rm
  6. Applied add-cube-cbrt0.1

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

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

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

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

    \[\leadsto \mathsf{fma}\left(x, 0.5, \color{blue}{y \cdot \left(2 \cdot \log \left(\sqrt[3]{z}\right) + \left(1 - z\right)\right)} + y \cdot \log \left(\sqrt[3]{z}\right)\right)\]
  11. Taylor expanded around inf 0.1

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

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

Reproduce

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