Average Error: 0.0 → 0.0
Time: 754.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 r57183 = x;
        double r57184 = y;
        double r57185 = 1.0;
        double r57186 = r57184 - r57185;
        double r57187 = r57183 * r57186;
        double r57188 = 0.5;
        double r57189 = r57184 * r57188;
        double r57190 = r57187 - r57189;
        double r57191 = 0.918938533204673;
        double r57192 = r57190 + r57191;
        return r57192;
}

double f(double x, double y) {
        double r57193 = x;
        double r57194 = y;
        double r57195 = 1.0;
        double r57196 = 0.5;
        double r57197 = r57196 * r57194;
        double r57198 = fma(r57195, r57193, r57197);
        double r57199 = -r57198;
        double r57200 = fma(r57193, r57194, r57199);
        double r57201 = 0.918938533204673;
        double r57202 = r57200 + r57201;
        return r57202;
}

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