Average Error: 0.0 → 0.0
Time: 1.3s
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 r37721 = x;
        double r37722 = y;
        double r37723 = 1.0;
        double r37724 = r37722 - r37723;
        double r37725 = r37721 * r37724;
        double r37726 = 0.5;
        double r37727 = r37722 * r37726;
        double r37728 = r37725 - r37727;
        double r37729 = 0.918938533204673;
        double r37730 = r37728 + r37729;
        return r37730;
}

double f(double x, double y) {
        double r37731 = x;
        double r37732 = y;
        double r37733 = 1.0;
        double r37734 = r37732 - r37733;
        double r37735 = 0.5;
        double r37736 = r37735 * r37732;
        double r37737 = -r37736;
        double r37738 = fma(r37731, r37734, r37737);
        double r37739 = -r37732;
        double r37740 = r37739 + r37732;
        double r37741 = 0.918938533204673;
        double r37742 = fma(r37735, r37740, r37741);
        double r37743 = r37738 + r37742;
        return r37743;
}

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