Average Error: 0.0 → 0.0
Time: 798.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 r35655 = x;
        double r35656 = y;
        double r35657 = 1.0;
        double r35658 = r35656 - r35657;
        double r35659 = r35655 * r35658;
        double r35660 = 0.5;
        double r35661 = r35656 * r35660;
        double r35662 = r35659 - r35661;
        double r35663 = 0.918938533204673;
        double r35664 = r35662 + r35663;
        return r35664;
}

double f(double x, double y) {
        double r35665 = y;
        double r35666 = x;
        double r35667 = 0.918938533204673;
        double r35668 = fma(r35665, r35666, r35667);
        double r35669 = 1.0;
        double r35670 = 0.5;
        double r35671 = r35665 * r35670;
        double r35672 = fma(r35666, r35669, r35671);
        double r35673 = r35668 - r35672;
        return r35673;
}

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