Average Error: 0.1 → 0.1
Time: 46.3s
Precision: 64
\[x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right)\]
\[\mathsf{fma}\left(x, 0.5, y \cdot 1 + \left(\left(\log \left(\sqrt[3]{z}\right) - z\right) \cdot y + y \cdot \log \left(\sqrt[3]{z} \cdot \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 1 + \left(\left(\log \left(\sqrt[3]{z}\right) - z\right) \cdot y + y \cdot \log \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right)\right)\right)
double f(double x, double y, double z) {
        double r14572383 = x;
        double r14572384 = 0.5;
        double r14572385 = r14572383 * r14572384;
        double r14572386 = y;
        double r14572387 = 1.0;
        double r14572388 = z;
        double r14572389 = r14572387 - r14572388;
        double r14572390 = log(r14572388);
        double r14572391 = r14572389 + r14572390;
        double r14572392 = r14572386 * r14572391;
        double r14572393 = r14572385 + r14572392;
        return r14572393;
}

double f(double x, double y, double z) {
        double r14572394 = x;
        double r14572395 = 0.5;
        double r14572396 = y;
        double r14572397 = 1.0;
        double r14572398 = r14572396 * r14572397;
        double r14572399 = z;
        double r14572400 = cbrt(r14572399);
        double r14572401 = log(r14572400);
        double r14572402 = r14572401 - r14572399;
        double r14572403 = r14572402 * r14572396;
        double r14572404 = r14572400 * r14572400;
        double r14572405 = log(r14572404);
        double r14572406 = r14572396 * r14572405;
        double r14572407 = r14572403 + r14572406;
        double r14572408 = r14572398 + r14572407;
        double r14572409 = fma(r14572394, r14572395, r14572408);
        return r14572409;
}

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

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

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

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

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

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

    \[\leadsto \mathsf{fma}\left(x, 0.5, \color{blue}{y \cdot \left(\left(1 + \log z\right) - z\right)}\right)\]
  10. Using strategy rm
  11. Applied associate--l+0.1

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

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

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

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

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

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

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

Reproduce

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