Average Error: 0.0 → 0.0
Time: 1.9s
Precision: binary64
\[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
\[\mathsf{fma}\left(y, x - 0.5, 0.918938533204673 - x\right) \]
(FPCore (x y)
 :precision binary64
 (+ (- (* x (- y 1.0)) (* y 0.5)) 0.918938533204673))
(FPCore (x y) :precision binary64 (fma y (- x 0.5) (- 0.918938533204673 x)))
double code(double x, double y) {
	return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673;
}
double code(double x, double y) {
	return fma(y, (x - 0.5), (0.918938533204673 - x));
}
function code(x, y)
	return Float64(Float64(Float64(x * Float64(y - 1.0)) - Float64(y * 0.5)) + 0.918938533204673)
end
function code(x, y)
	return fma(y, Float64(x - 0.5), Float64(0.918938533204673 - x))
end
code[x_, y_] := N[(N[(N[(x * N[(y - 1.0), $MachinePrecision]), $MachinePrecision] - N[(y * 0.5), $MachinePrecision]), $MachinePrecision] + 0.918938533204673), $MachinePrecision]
code[x_, y_] := N[(y * N[(x - 0.5), $MachinePrecision] + N[(0.918938533204673 - x), $MachinePrecision]), $MachinePrecision]
\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673
\mathsf{fma}\left(y, x - 0.5, 0.918938533204673 - x\right)

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.918938533204673 \]
  2. Simplified0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(y, x + -0.5, 0.918938533204673\right) - x} \]
  3. Applied *-un-lft-identity_binary640.0

    \[\leadsto \mathsf{fma}\left(y, x + -0.5, 0.918938533204673\right) - \color{blue}{1 \cdot x} \]
  4. Applied *-un-lft-identity_binary640.0

    \[\leadsto \color{blue}{1 \cdot \mathsf{fma}\left(y, x + -0.5, 0.918938533204673\right)} - 1 \cdot x \]
  5. Applied distribute-lft-out--_binary640.0

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

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

    \[\leadsto \mathsf{fma}\left(y, x - 0.5, 0.918938533204673 - x\right) \]

Reproduce

herbie shell --seed 2022129 
(FPCore (x y)
  :name "Numeric.SpecFunctions:logGamma from math-functions-0.1.5.2, A"
  :precision binary64
  (+ (- (* x (- y 1.0)) (* y 0.5)) 0.918938533204673))