def method_gamma(self, space, value): try: res = rfloat.gamma(value) except ValueError: if value == 0.0: # produce an infinity with the right sign res = rfloat.copysign(rfloat.INFINITY, value) else: raise space.error(space.getclassfor(W_DomainError), 'Numerical argument is out of domain - "gamma"') except OverflowError: res = rfloat.INFINITY return space.newfloat(res)
def method_gamma(self, space, value): try: res = rfloat.gamma(value) except ValueError: if value == 0.0: # produce an infinity with the right sign res = rfloat.copysign(rfloat.INFINITY, value) else: raise space.error( space.getclassfor(W_DomainError), 'Numerical argument is out of domain - "gamma"') except OverflowError: res = rfloat.INFINITY return space.newfloat(res)
def wrapper(arg): try: return gamma(arg) except OverflowError: return -42