code: def test_705836(self):
      # SF bug 705836.  "<f" and ">f" had a severe rounding bug, where a carry
      # from the low-order discarded bits could propagate into the exponent
      # field, causing the result to be wrong by a factor of 2.
      for base in range(1, 33):
          # smaller <- largest representable float less than base.
          delta = 0.5
          while base - delta / 2.0 != base:
              delta /= 2.0
          smaller = base - delta
          # Packing this rounds away a solid string of trailing 1 bits.
          packed = struct.pack("<f", smaller)
          unpacked = struct.unpack("<f", packed)[0]
          # This failed at base = 2, 4, and 32, with unpacked = 1, 2, and
          # 16, respectively.
          self.assertEqual(base, unpacked)
          bigpacked = struct.pack(">f", smaller)
          self.assertEqual(bigpacked, string_reverse(packed))
          unpacked = struct.unpack(">f", bigpacked)[0]
          self.assertEqual(base, unpacked)
  
      # Largest finite IEEE single.
      big = (1 << 24) - 1
      big = math.ldexp(big, 127 - 23)
      packed = struct.pack(">f", big)
      unpacked = struct.unpack(">f", packed)[0]
      self.assertEqual(big, unpacked)
  
      # The same, but tack on a 1 bit so it rounds up to infinity.
      big = (1 << 25) - 1
      big = math.ldexp(big, 127 - 24)
      self.assertRaises(OverflowError, struct.pack, ">f", big)
  
imports: from collections import abc
  import array
  import gc
  import math
  import operator
  import unittest
  import struct
  import sys
  import weakref
  from test import support
  from test.support import import_helper
  from test.support.script_helper import assert_python_ok
label_desc: Use image node_id 9 for calling the StructTest obj's underlying member method code with example usage: obj.test_705836() without return types