Average Error: 0.0 → 0.0
Time: 1.4s
Precision: 64
\[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673003\]
\[\mathsf{fma}\left(x, y, -\mathsf{fma}\left(1, x, 0.5 \cdot y\right)\right) + 0.918938533204673003\]
\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673003
\mathsf{fma}\left(x, y, -\mathsf{fma}\left(1, x, 0.5 \cdot y\right)\right) + 0.918938533204673003
double f(double x, double y) {
        double r44235 = x;
        double r44236 = y;
        double r44237 = 1.0;
        double r44238 = r44236 - r44237;
        double r44239 = r44235 * r44238;
        double r44240 = 0.5;
        double r44241 = r44236 * r44240;
        double r44242 = r44239 - r44241;
        double r44243 = 0.918938533204673;
        double r44244 = r44242 + r44243;
        return r44244;
}

double f(double x, double y) {
        double r44245 = x;
        double r44246 = y;
        double r44247 = 1.0;
        double r44248 = 0.5;
        double r44249 = r44248 * r44246;
        double r44250 = fma(r44247, r44245, r44249);
        double r44251 = -r44250;
        double r44252 = fma(r44245, r44246, r44251);
        double r44253 = 0.918938533204673;
        double r44254 = r44252 + r44253;
        return r44254;
}

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. Taylor expanded around 0 0.0

    \[\leadsto \color{blue}{\left(x \cdot y - \left(1 \cdot x + 0.5 \cdot y\right)\right)} + 0.918938533204673003\]
  3. Simplified0.0

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

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

Reproduce

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