Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

from __future__ import absolute_import 

import mpmath 

 

# Patch mpmath to use Cythonized functions 

from . import utils as _utils 

 

# Also import internal functions 

from mpmath.libmp import * 

 

# Main namespace 

from mpmath import * 

 

# Utilities 

from .utils import call, mpmath_to_sage, sage_to_mpmath 

 

# Use mpmath internal functions for constants, to avoid unnecessary overhead 

_constants_funcs = { 

'glaisher' : glaisher_fixed, 

'khinchin' : khinchin_fixed, 

'twinprime' : twinprime_fixed, 

'mertens' : mertens_fixed 

} 

 

def eval_constant(name, ring): 

prec = ring.precision() + 20 

return ring(_constants_funcs[name](prec)) >> prec