code: def float_to_byte(value, mantissabits=5, zeroexp=2):
      """Encodes a floating point number in a single byte."""
  
      # Assume int size == float size
  
      fzero = (63 - zeroexp) << mantissabits
      bits = unpack("i", pack("f", value))[0]
      smallfloat = bits >> (24 - mantissabits)
      if smallfloat < fzero:
          # Map negative numbers and 0 to 0
          # Map underflow to next smallest non-zero number
          if bits <= 0:
              result = chr(0)
          else:
              result = chr(1)
      elif smallfloat >= fzero + 0x100:
          # Map overflow to largest number
          result = chr(255)
      else:
          result = chr(smallfloat - fzero)
      return b(result)
  
imports: import math, struct
  from array import array
  from bisect import bisect_left
  from struct import pack, unpack
  from whoosh.compat import b, long_type
  from whoosh.system import pack_byte, unpack_byte, pack_ushort, unpack_ushort
  from whoosh.system import pack_int, unpack_int, pack_uint, unpack_uint
  from whoosh.system import pack_long, unpack_long, pack_ulong, unpack_ulong
  from whoosh.system import pack_float, unpack_float, pack_double, unpack_double
label_desc: Use image node_id 11 for calling a global function with example usage: float_to_byte(value, mantissabits, zeroexp) and returns: b