MCPcopy Create free account
hub / github.com/python/cpython / bin_incr_digits

Function bin_incr_digits

Modules/_decimal/tests/randdec.py:343–384  ·  view source on GitHub ↗
(prec, maxexp, itr)

Source from the content-addressed store, hash-verified

341
342# If itr == None, test all combinations of digit lengths up to prec + 30
343def bin_incr_digits(prec, maxexp, itr):
344 if itr is None:
345 lst1 = range(prec+30)
346 lst2 = range(prec+30)
347 else:
348 lst1 = sample(range(prec+30), itr)
349 lst2 = sample(range(prec+30), itr)
350 for m in lst1:
351 x = from_triple(1, ndigits(m), 0)
352 yield x, x
353 x = from_triple(-1, ndigits(m), 0)
354 yield x, x
355 x = from_triple(1, ndigits(m), randrange(maxexp))
356 yield x, x
357 x = from_triple(-1, ndigits(m), randrange(maxexp))
358 yield x, x
359 for m in lst1:
360 for n in lst2:
361 x = from_triple(1, ndigits(m), 0)
362 y = from_triple(1, ndigits(n), 0)
363 yield x, y
364 x = from_triple(-1, ndigits(m), 0)
365 y = from_triple(1, ndigits(n), 0)
366 yield x, y
367 x = from_triple(1, ndigits(m), 0)
368 y = from_triple(-1, ndigits(n), 0)
369 yield x, y
370 x = from_triple(-1, ndigits(m), 0)
371 y = from_triple(-1, ndigits(n), 0)
372 yield x, y
373 x = from_triple(1, ndigits(m), randrange(maxexp))
374 y = from_triple(1, ndigits(n), randrange(maxexp))
375 yield x, y
376 x = from_triple(-1, ndigits(m), randrange(maxexp))
377 y = from_triple(1, ndigits(n), randrange(maxexp))
378 yield x, y
379 x = from_triple(1, ndigits(m), randrange(maxexp))
380 y = from_triple(-1, ndigits(n), randrange(maxexp))
381 yield x, y
382 x = from_triple(-1, ndigits(m), randrange(maxexp))
383 y = from_triple(-1, ndigits(n), randrange(maxexp))
384 yield x, y
385
386
387def randsign():

Callers 1

all_binaryFunction · 0.85

Calls 3

sampleFunction · 0.85
from_tripleFunction · 0.85
ndigitsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…