Average Error: 0.0 → 0.0
Time: 1.6s
Precision: 64
\[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673003\]
\[\mathsf{fma}\left(x, y - 1, -0.5 \cdot y\right) + \mathsf{fma}\left(0.5, \left(-y\right) + y, 0.918938533204673003\right)\]
\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673003
\mathsf{fma}\left(x, y - 1, -0.5 \cdot y\right) + \mathsf{fma}\left(0.5, \left(-y\right) + y, 0.918938533204673003\right)
double f(double x, double y) {
        double r55278 = x;
        double r55279 = y;
        double r55280 = 1.0;
        double r55281 = r55279 - r55280;
        double r55282 = r55278 * r55281;
        double r55283 = 0.5;
        double r55284 = r55279 * r55283;
        double r55285 = r55282 - r55284;
        double r55286 = 0.918938533204673;
        double r55287 = r55285 + r55286;
        return r55287;
}

double f(double x, double y) {
        double r55288 = x;
        double r55289 = y;
        double r55290 = 1.0;
        double r55291 = r55289 - r55290;
        double r55292 = 0.5;
        double r55293 = r55292 * r55289;
        double r55294 = -r55293;
        double r55295 = fma(r55288, r55291, r55294);
        double r55296 = -r55289;
        double r55297 = r55296 + r55289;
        double r55298 = 0.918938533204673;
        double r55299 = fma(r55292, r55297, r55298);
        double r55300 = r55295 + r55299;
        return r55300;
}

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. Using strategy rm
  3. Applied prod-diff0.0

    \[\leadsto \color{blue}{\left(\mathsf{fma}\left(x, y - 1, -0.5 \cdot y\right) + \mathsf{fma}\left(-0.5, y, 0.5 \cdot y\right)\right)} + 0.918938533204673003\]
  4. Applied associate-+l+0.0

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

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

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

Reproduce

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