def __init__(self, lower_bound, upper_bound): FloatStrategy.__init__(self) self.lower_bound = float(lower_bound) self.upper_bound = float(upper_bound) assert upper_bound >= lower_bound if lower_bound >= 0 or upper_bound < 0: self.template_upper_bound = infinitish( float_to_int(upper_bound) - float_to_int(lower_bound) + 1 ) else: self.template_upper_bound = infinitish( float_to_int(upper_bound) + ( MAX_NEGATIVE_FLOAT_AS_INT - float_to_int(lower_bound) + 2 ) )
def fact(n): x = 1 for k in hrange(1, n + 1): x = safe_mul(x, k) if x >= EFFECTIVELY_INFINITE: break return infinitish(x)
def __init__(self, start, end): SearchStrategy.__init__(self) self.start = start self.end = end if start > end: raise ValueError('Invalid range [%d, %d]' % (start, end)) self.template_upper_bound = infinitish(end - start + 1)
def __init__(self, start, end): SearchStrategy.__init__(self) self.start = start self.end = end if start > end: raise ValueError(u'Invalid range [%d, %d]' % (start, end)) self.template_upper_bound = infinitish(end - start + 1)