Average Error: 0.1 → 0.1
Time: 5.9s
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 r271431 = x;
        double r271432 = 0.5;
        double r271433 = r271431 * r271432;
        double r271434 = y;
        double r271435 = 1.0;
        double r271436 = z;
        double r271437 = r271435 - r271436;
        double r271438 = log(r271436);
        double r271439 = r271437 + r271438;
        double r271440 = r271434 * r271439;
        double r271441 = r271433 + r271440;
        return r271441;
}

double f(double x, double y, double z) {
        double r271442 = x;
        double r271443 = 0.5;
        double r271444 = r271442 * r271443;
        double r271445 = y;
        double r271446 = 2.0;
        double r271447 = z;
        double r271448 = cbrt(r271447);
        double r271449 = log(r271448);
        double r271450 = 1.0;
        double r271451 = r271450 - r271447;
        double r271452 = fma(r271446, r271449, r271451);
        double r271453 = r271445 * r271452;
        double r271454 = 0.3333333333333333;
        double r271455 = pow(r271447, r271454);
        double r271456 = log(r271455);
        double r271457 = r271456 * r271445;
        double r271458 = r271453 + r271457;
        double r271459 = r271444 + r271458;
        return r271459;
}

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