Average Error: 0.1 → 0.1
Time: 17.8s
Precision: 64
\[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z\]
\[\left(x + \mathsf{fma}\left(\mathsf{fma}\left(1.5, \frac{-1}{3}, -y\right), \log y, y\right)\right) - z\]
\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z
\left(x + \mathsf{fma}\left(\mathsf{fma}\left(1.5, \frac{-1}{3}, -y\right), \log y, y\right)\right) - z
double f(double x, double y, double z) {
        double r266376 = x;
        double r266377 = y;
        double r266378 = 0.5;
        double r266379 = r266377 + r266378;
        double r266380 = log(r266377);
        double r266381 = r266379 * r266380;
        double r266382 = r266376 - r266381;
        double r266383 = r266382 + r266377;
        double r266384 = z;
        double r266385 = r266383 - r266384;
        return r266385;
}

double f(double x, double y, double z) {
        double r266386 = x;
        double r266387 = 1.5;
        double r266388 = -0.3333333333333333;
        double r266389 = y;
        double r266390 = -r266389;
        double r266391 = fma(r266387, r266388, r266390);
        double r266392 = log(r266389);
        double r266393 = fma(r266391, r266392, r266389);
        double r266394 = r266386 + r266393;
        double r266395 = z;
        double r266396 = r266394 - r266395;
        return r266396;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original0.1
Target0.1
Herbie0.1
\[\left(\left(y + x\right) - z\right) - \left(y + 0.5\right) \cdot \log y\]

Derivation

  1. Initial program 0.1

    \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z\]
  2. Using strategy rm
  3. Applied add-cube-cbrt0.1

    \[\leadsto \left(\left(x - \left(y + 0.5\right) \cdot \log \color{blue}{\left(\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \sqrt[3]{y}\right)}\right) + y\right) - z\]
  4. Applied log-prod0.2

    \[\leadsto \left(\left(x - \left(y + 0.5\right) \cdot \color{blue}{\left(\log \left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) + \log \left(\sqrt[3]{y}\right)\right)}\right) + y\right) - z\]
  5. Applied distribute-lft-in0.2

    \[\leadsto \left(\left(x - \color{blue}{\left(\left(y + 0.5\right) \cdot \log \left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) + \left(y + 0.5\right) \cdot \log \left(\sqrt[3]{y}\right)\right)}\right) + y\right) - z\]
  6. Simplified0.2

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

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

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

    \[\leadsto \left(\left(x - \color{blue}{\left(\left(-\log y\right) \cdot \frac{-1}{3}\right) \cdot \mathsf{fma}\left(3, y, 1.5\right)}\right) + y\right) - z\]
  10. Using strategy rm
  11. Applied sub-neg0.2

    \[\leadsto \left(\color{blue}{\left(x + \left(-\left(\left(-\log y\right) \cdot \frac{-1}{3}\right) \cdot \mathsf{fma}\left(3, y, 1.5\right)\right)\right)} + y\right) - z\]
  12. Applied associate-+l+0.2

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

    \[\leadsto \left(x + \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(1.5, \frac{-1}{3}, -y\right), \log y, y\right)}\right) - z\]
  14. Final simplification0.1

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

Reproduce

herbie shell --seed 2019235 +o rules:numerics
(FPCore (x y z)
  :name "Numeric.SpecFunctions:stirlingError from math-functions-0.1.5.2"
  :precision binary64

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

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