Average Error: 0.1 → 0.1
Time: 56.5s
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 r254136 = x;
        double r254137 = y;
        double r254138 = 0.5;
        double r254139 = r254137 + r254138;
        double r254140 = log(r254137);
        double r254141 = r254139 * r254140;
        double r254142 = r254136 - r254141;
        double r254143 = r254142 + r254137;
        double r254144 = z;
        double r254145 = r254143 - r254144;
        return r254145;
}

double f(double x, double y, double z) {
        double r254146 = x;
        double r254147 = y;
        double r254148 = log(r254147);
        double r254149 = 0.5;
        double r254150 = r254147 + r254149;
        double r254151 = z;
        double r254152 = r254147 - r254151;
        double r254153 = -r254152;
        double r254154 = fma(r254148, r254150, r254153);
        double r254155 = r254146 - r254154;
        return r254155;
}

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