Average Error: 0.1 → 0.1
Time: 1.3m
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 r574158 = x;
        double r574159 = y;
        double r574160 = 0.5;
        double r574161 = r574159 + r574160;
        double r574162 = log(r574159);
        double r574163 = r574161 * r574162;
        double r574164 = r574158 - r574163;
        double r574165 = r574164 + r574159;
        double r574166 = z;
        double r574167 = r574165 - r574166;
        return r574167;
}

double f(double x, double y, double z) {
        double r574168 = y;
        double r574169 = x;
        double r574170 = r574168 + r574169;
        double r574171 = log(r574168);
        double r574172 = 0.5;
        double r574173 = r574168 + r574172;
        double r574174 = z;
        double r574175 = fma(r574171, r574173, r574174);
        double r574176 = r574170 - r574175;
        return r574176;
}

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