Average Error: 0.1 → 0.1
Time: 19.2s
Precision: 64
\[x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right)\]
\[\mathsf{fma}\left(y, \mathsf{fma}\left(\frac{2}{3}, \log z, \log \left(\sqrt[3]{z}\right) + \left(1 - z\right)\right), x \cdot 0.5\right)\]
x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right)
\mathsf{fma}\left(y, \mathsf{fma}\left(\frac{2}{3}, \log z, \log \left(\sqrt[3]{z}\right) + \left(1 - z\right)\right), x \cdot 0.5\right)
double f(double x, double y, double z) {
        double r10770609 = x;
        double r10770610 = 0.5;
        double r10770611 = r10770609 * r10770610;
        double r10770612 = y;
        double r10770613 = 1.0;
        double r10770614 = z;
        double r10770615 = r10770613 - r10770614;
        double r10770616 = log(r10770614);
        double r10770617 = r10770615 + r10770616;
        double r10770618 = r10770612 * r10770617;
        double r10770619 = r10770611 + r10770618;
        return r10770619;
}

double f(double x, double y, double z) {
        double r10770620 = y;
        double r10770621 = 0.6666666666666666;
        double r10770622 = z;
        double r10770623 = log(r10770622);
        double r10770624 = cbrt(r10770622);
        double r10770625 = log(r10770624);
        double r10770626 = 1.0;
        double r10770627 = r10770626 - r10770622;
        double r10770628 = r10770625 + r10770627;
        double r10770629 = fma(r10770621, r10770623, r10770628);
        double r10770630 = x;
        double r10770631 = 0.5;
        double r10770632 = r10770630 * r10770631;
        double r10770633 = fma(r10770620, r10770629, r10770632);
        return r10770633;
}

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(y, \log z + \left(1 - z\right), x \cdot 0.5\right)}\]
  3. Using strategy rm
  4. Applied add-cube-cbrt0.1

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

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

    \[\leadsto \mathsf{fma}\left(y, \color{blue}{\log \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) + \left(\log \left(\sqrt[3]{z}\right) + \left(1 - z\right)\right)}, x \cdot 0.5\right)\]
  7. Using strategy rm
  8. Applied pow1/30.1

    \[\leadsto \mathsf{fma}\left(y, \log \left(\sqrt[3]{z} \cdot \color{blue}{{z}^{\frac{1}{3}}}\right) + \left(\log \left(\sqrt[3]{z}\right) + \left(1 - z\right)\right), x \cdot 0.5\right)\]
  9. Applied pow1/30.1

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

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

    \[\leadsto \mathsf{fma}\left(y, \log \left({z}^{\color{blue}{\frac{2}{3}}}\right) + \left(\log \left(\sqrt[3]{z}\right) + \left(1 - z\right)\right), x \cdot 0.5\right)\]
  12. Using strategy rm
  13. Applied log-pow0.1

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

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

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

Reproduce

herbie shell --seed 2019174 +o rules:numerics
(FPCore (x y z)
  :name "System.Random.MWC.Distributions:gamma from mwc-random-0.13.3.2"

  :herbie-target
  (- (+ y (* 0.5 x)) (* y (- z (log z))))

  (+ (* x 0.5) (* y (+ (- 1.0 z) (log z)))))