Average Error: 0.0 → 0.0
Time: 759.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 r39528 = x;
        double r39529 = y;
        double r39530 = 1.0;
        double r39531 = r39529 - r39530;
        double r39532 = r39528 * r39531;
        double r39533 = 0.5;
        double r39534 = r39529 * r39533;
        double r39535 = r39532 - r39534;
        double r39536 = 0.918938533204673;
        double r39537 = r39535 + r39536;
        return r39537;
}

double f(double x, double y) {
        double r39538 = y;
        double r39539 = x;
        double r39540 = 0.918938533204673;
        double r39541 = fma(r39538, r39539, r39540);
        double r39542 = 1.0;
        double r39543 = 0.5;
        double r39544 = r39538 * r39543;
        double r39545 = fma(r39539, r39542, r39544);
        double r39546 = r39541 - r39545;
        return r39546;
}

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