"""TEST-ONLY stand-in for python-flint (float based, radius 0). NOT rigorous. Used only to debug the certificate scripts in an environment without python-flint. The real run must use python-flint.""" import math class ctx: prec=53 class arb: __slots__=('v',) def __init__(s,v=0.0,r=None): if isinstance(v,arb): v=v.v s.v=float(v) @staticmethod def pi(): return arb(math.pi) def lower(s): return arb(s.v) def upper(s): return arb(s.v) def mid(s): return arb(s.v) def rad(s): return arb(0.0) def __float__(s): return s.v def log(s): return arb(math.log(s.v)) def exp(s): return arb(math.exp(s.v)) def sqrt(s): return arb(math.sqrt(s.v)) def cos(s): return arb(math.cos(s.v)) def sin(s): return arb(math.sin(s.v)) def atan(s): return arb(math.atan(s.v)) def __add__(s,o): if type(o).__name__=='acb': return NotImplemented return arb(s.v+arb(o).v) __radd__=__add__ def __sub__(s,o): if type(o).__name__=='acb': return NotImplemented return arb(s.v-arb(o).v) def __rsub__(s,o): if type(o).__name__=='acb': return NotImplemented return arb(arb(o).v-s.v) def __mul__(s,o): if type(o).__name__=='acb': return NotImplemented return arb(s.v*arb(o).v) __rmul__=__mul__ def __truediv__(s,o): if type(o).__name__=='acb': return NotImplemented return arb(s.v/arb(o).v) def __rtruediv__(s,o): if type(o).__name__=='acb': return NotImplemented return arb(arb(o).v/s.v) def __neg__(s): return arb(-s.v) def __pow__(s,o): return arb(s.v**arb(o).v) def __abs__(s): return arb(abs(s.v)) def __lt__(s,o): return s.varb(o).v def __repr__(s): return 'arb(%r)'%s.v import cmath class acb: __slots__=('v',) def __init__(s,re=0.0,im=0.0): if isinstance(re,acb): s.v=re.v; return s.v=complex(float(arb(re).v) if not isinstance(re,complex) else re)+1j*float(arb(im).v) @property def real(s): return arb(s.v.real) @property def imag(s): return arb(s.v.imag) def log(s): return acb._c(cmath.log(s.v)) def exp(s): return acb._c(cmath.exp(s.v)) @staticmethod def _c(z): a=acb(); a.v=z; return a @staticmethod def _v(o): if isinstance(o,acb): return o.v if isinstance(o,arb): return o.v return complex(o) def __add__(s,o): return acb._c(s.v+acb._v(o)) __radd__=__add__ def __sub__(s,o): return acb._c(s.v-acb._v(o)) def __rsub__(s,o): return acb._c(acb._v(o)-s.v) def __mul__(s,o): return acb._c(s.v*acb._v(o)) __rmul__=__mul__ def __truediv__(s,o): return acb._c(s.v/acb._v(o)) def __rtruediv__(s,o): return acb._c(acb._v(o)/s.v) def __neg__(s): return acb._c(-s.v) def __abs__(s): return arb(abs(s.v))