Average Error: 0.1 → 0.1
Time: 49.9s
Precision: 64
\[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z\]
\[\left(y + x\right) - \mathsf{fma}\left(\log y, y + 0.5, z\right)\]
\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z
\left(y + x\right) - \mathsf{fma}\left(\log y, y + 0.5, z\right)
double f(double x, double y, double z) {
        double r234516 = x;
        double r234517 = y;
        double r234518 = 0.5;
        double r234519 = r234517 + r234518;
        double r234520 = log(r234517);
        double r234521 = r234519 * r234520;
        double r234522 = r234516 - r234521;
        double r234523 = r234522 + r234517;
        double r234524 = z;
        double r234525 = r234523 - r234524;
        return r234525;
}

double f(double x, double y, double z) {
        double r234526 = y;
        double r234527 = x;
        double r234528 = r234526 + r234527;
        double r234529 = log(r234526);
        double r234530 = 0.5;
        double r234531 = r234526 + r234530;
        double r234532 = z;
        double r234533 = fma(r234529, r234531, r234532);
        double r234534 = r234528 - r234533;
        return r234534;
}

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. Simplified0.1

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

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

Reproduce

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