Average Error: 0.0 → 0.0
Time: 765.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 r40807 = x;
        double r40808 = y;
        double r40809 = 1.0;
        double r40810 = r40808 - r40809;
        double r40811 = r40807 * r40810;
        double r40812 = 0.5;
        double r40813 = r40808 * r40812;
        double r40814 = r40811 - r40813;
        double r40815 = 0.918938533204673;
        double r40816 = r40814 + r40815;
        return r40816;
}

double f(double x, double y) {
        double r40817 = x;
        double r40818 = y;
        double r40819 = 1.0;
        double r40820 = 0.5;
        double r40821 = r40820 * r40818;
        double r40822 = fma(r40819, r40817, r40821);
        double r40823 = -r40822;
        double r40824 = fma(r40817, r40818, r40823);
        double r40825 = 0.918938533204673;
        double r40826 = r40824 + r40825;
        return r40826;
}

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