"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "mpmath/functions/factorials.py" between
mpmath-1.0.0.tar.gz and mpmath-1.1.0.tar.gz

About: mpmath is a Python library for arbitrary-precision floating-point arithmetic.

factorials.py  (mpmath-1.0.0):factorials.py  (mpmath-1.1.0)
skipping to change at line 58 skipping to change at line 58
if x == ctx.inf and not ctx._im(y): if x == ctx.inf and not ctx._im(y):
if y == ctx.ninf: if y == ctx.ninf:
return ctx.nan return ctx.nan
if y > 0: if y > 0:
return ctx.zero return ctx.zero
if ctx.isint(y): if ctx.isint(y):
return ctx.nan return ctx.nan
if y < 0: if y < 0:
return ctx.sign(ctx.gamma(y)) * ctx.inf return ctx.sign(ctx.gamma(y)) * ctx.inf
return ctx.nan return ctx.nan
return ctx.gammaprod([x, y], [x+y]) xy = ctx.fadd(x, y, prec=2*ctx.prec)
return ctx.gammaprod([x, y], [xy])
@defun @defun
def binomial(ctx, n, k): def binomial(ctx, n, k):
return ctx.gammaprod([n+1], [k+1, n-k+1]) n1 = ctx.fadd(n, 1, prec=2*ctx.prec)
k1 = ctx.fadd(k, 1, prec=2*ctx.prec)
nk1 = ctx.fsub(n1, k, prec=2*ctx.prec)
return ctx.gammaprod([n1], [k1, nk1])
@defun @defun
def rf(ctx, x, n): def rf(ctx, x, n):
return ctx.gammaprod([x+n], [x]) xn = ctx.fadd(x, n, prec=2*ctx.prec)
return ctx.gammaprod([xn], [x])
@defun @defun
def ff(ctx, x, n): def ff(ctx, x, n):
return ctx.gammaprod([x+1], [x-n+1]) x1 = ctx.fadd(x, 1, prec=2*ctx.prec)
xn1 = ctx.fadd(ctx.fsub(x, n, prec=2*ctx.prec), 1, prec=2*ctx.prec)
return ctx.gammaprod([x1], [xn1])
@defun_wrapped @defun_wrapped
def fac2(ctx, x): def fac2(ctx, x):
if ctx.isinf(x): if ctx.isinf(x):
if x == ctx.inf: if x == ctx.inf:
return x return x
return ctx.nan return ctx.nan
return 2**(x/2)*(ctx.pi/2)**((ctx.cospi(x)-1)/4)*ctx.gamma(x/2+1) return 2**(x/2)*(ctx.pi/2)**((ctx.cospi(x)-1)/4)*ctx.gamma(x/2+1)
@defun_wrapped @defun_wrapped
 End of changes. 4 change blocks. 
4 lines changed or deleted 11 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)