code: def test_halfway_cases():
      # test halfway cases for the round-half-to-even rule
      for i in range(1000):
          for j in range(TEST_SIZE):
              # bit pattern for a random finite positive (or +0.0) float
              bits = random.randrange(2047 * 2**52)
  
              # convert bit pattern to a number of the form m * 2**e
              e, m = divmod(bits, 2**52)
              if e:
                  m, e = m + 2**52, e - 1
              e -= 1074
  
              # add 0.5 ulps
              m, e = 2 * m + 1, e - 1
  
              # convert to a decimal string
              if e >= 0:
                  digits = m << e
                  exponent = 0
              else:
                  # m * 2**e = (m * 5**-e) * 10**e
                  digits = m * 5**-e
                  exponent = e
              s = "{}e{}".format(digits, exponent)
              yield s
  
file_path: cpython/Modules/_decimal/tests/randfloat.py
imports: import random
label_desc: Use image node_id 2 for calling a global function with example usage: test_halfway_cases() without return types