import mpmath12# Patch mpmath to use Cythonized functions3import utils as _utils4#mpmath.libmp.normalize = mpmath.libmp.normalize1 = normalize = _utils.normalize5#mpmath.libmp.from_man_exp = from_man_exp = _utils.from_man_exp67# Also import internal functions8from mpmath.libmp import *910# Main namespace11from mpmath import *1213# Utilities14from utils import call, mpmath_to_sage, sage_to_mpmath1516# Use mpmath internal functions for constants, to avoid unnecessary overhead17_constants_funcs = {18'glaisher' : glaisher_fixed,19'khinchin' : khinchin_fixed,20'twinprime' : twinprime_fixed,21'mertens' : mertens_fixed22}2324def eval_constant(name, ring):25prec = ring.precision() + 2026return ring(_constants_funcs[name](prec)) >> prec27282930