Average Error: 0.0 → 0.0
Time: 713.0ms
Precision: 64
\[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673003\]
\[\mathsf{fma}\left(y, x, 0.918938533204673003\right) - \mathsf{fma}\left(x, 1, y \cdot 0.5\right)\]
\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673003
\mathsf{fma}\left(y, x, 0.918938533204673003\right) - \mathsf{fma}\left(x, 1, y \cdot 0.5\right)
double f(double x, double y) {
        double r45272 = x;
        double r45273 = y;
        double r45274 = 1.0;
        double r45275 = r45273 - r45274;
        double r45276 = r45272 * r45275;
        double r45277 = 0.5;
        double r45278 = r45273 * r45277;
        double r45279 = r45276 - r45278;
        double r45280 = 0.918938533204673;
        double r45281 = r45279 + r45280;
        return r45281;
}

double f(double x, double y) {
        double r45282 = y;
        double r45283 = x;
        double r45284 = 0.918938533204673;
        double r45285 = fma(r45282, r45283, r45284);
        double r45286 = 1.0;
        double r45287 = 0.5;
        double r45288 = r45282 * r45287;
        double r45289 = fma(r45283, r45286, r45288);
        double r45290 = r45285 - r45289;
        return r45290;
}

Error

Bits error versus x

Bits error versus y

Derivation

  1. Initial program 0.0

    \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673003\]
  2. Simplified0.0

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

    \[\leadsto \mathsf{fma}\left(y, x, 0.918938533204673003\right) - \mathsf{fma}\left(x, 1, y \cdot 0.5\right)\]

Reproduce

herbie shell --seed 2020034 +o rules:numerics
(FPCore (x y)
  :name "Numeric.SpecFunctions:logGamma from math-functions-0.1.5.2, A"
  :precision binary64
  (+ (- (* x (- y 1)) (* y 0.5)) 0.918938533204673))