Esempio n. 1
0
 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)
Esempio n. 2
0
 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)
Esempio n. 3
0
 def wrapper(arg):
     try:
         return gamma(arg)
     except OverflowError:
         return -42
Esempio n. 4
0
 def wrapper(arg):
     try:
         return gamma(arg)
     except OverflowError:
         return -42