MCPcopy Index your code
hub / github.com/python/cpython / rand_adjexp

Function rand_adjexp

Modules/_decimal/tests/randdec.py:119–124  ·  view source on GitHub ↗
(maxprec, maxadjexp)

Source from the content-addressed store, hash-verified

117 return numeric_string(maxprec, maxexp)
118
119def rand_adjexp(maxprec, maxadjexp):
120 d = digits(maxprec)
121 maxexp = maxadjexp-len(d)+1
122 if maxexp == 0: maxexp = 1
123 exp = str(randrange(maxexp-2*(abs(maxexp)), maxexp))
124 return ''.join((sign(), d, 'E', exp))
125
126
127def ndigits(n):

Callers

nothing calls this directly

Calls 5

digitsFunction · 0.85
strFunction · 0.85
absFunction · 0.85
signFunction · 0.70
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…