Average Error: 0.0 → 0.0
Time: 922.0ms
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 r29472 = x;
        double r29473 = y;
        double r29474 = 1.0;
        double r29475 = r29473 - r29474;
        double r29476 = r29472 * r29475;
        double r29477 = 0.5;
        double r29478 = r29473 * r29477;
        double r29479 = r29476 - r29478;
        double r29480 = 0.918938533204673;
        double r29481 = r29479 + r29480;
        return r29481;
}

double f(double x, double y) {
        double r29482 = x;
        double r29483 = y;
        double r29484 = 1.0;
        double r29485 = 0.5;
        double r29486 = r29485 * r29483;
        double r29487 = fma(r29484, r29482, r29486);
        double r29488 = -r29487;
        double r29489 = fma(r29482, r29483, r29488);
        double r29490 = 0.918938533204673;
        double r29491 = r29489 + r29490;
        return r29491;
}

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