Average Error: 0.1 → 0.1
Time: 50.9s
Precision: 64
\[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z\]
\[x - \mathsf{fma}\left(\log y, y + 0.5, -\left(y - z\right)\right)\]
\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z
x - \mathsf{fma}\left(\log y, y + 0.5, -\left(y - z\right)\right)
double f(double x, double y, double z) {
        double r272430 = x;
        double r272431 = y;
        double r272432 = 0.5;
        double r272433 = r272431 + r272432;
        double r272434 = log(r272431);
        double r272435 = r272433 * r272434;
        double r272436 = r272430 - r272435;
        double r272437 = r272436 + r272431;
        double r272438 = z;
        double r272439 = r272437 - r272438;
        return r272439;
}

double f(double x, double y, double z) {
        double r272440 = x;
        double r272441 = y;
        double r272442 = log(r272441);
        double r272443 = 0.5;
        double r272444 = r272441 + r272443;
        double r272445 = z;
        double r272446 = r272441 - r272445;
        double r272447 = -r272446;
        double r272448 = fma(r272442, r272444, r272447);
        double r272449 = r272440 - r272448;
        return r272449;
}

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 associate--l+0.1

    \[\leadsto \color{blue}{\left(x - \left(y + 0.5\right) \cdot \log y\right) + \left(y - z\right)}\]
  4. Using strategy rm
  5. Applied add-sqr-sqrt0.3

    \[\leadsto \left(x - \color{blue}{\left(\sqrt{y + 0.5} \cdot \sqrt{y + 0.5}\right)} \cdot \log y\right) + \left(y - z\right)\]
  6. Applied associate-*l*0.3

    \[\leadsto \left(x - \color{blue}{\sqrt{y + 0.5} \cdot \left(\sqrt{y + 0.5} \cdot \log y\right)}\right) + \left(y - z\right)\]
  7. Using strategy rm
  8. Applied associate-+l-0.3

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

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

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

Reproduce

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