import struct


def floatToBytes(flt):
    """
    Encodes a float to bytes.

    Args:
        flt (float): The float to encode.

    Returns:
        bytearray: The encoded float.
    """
    return bytearray(struct.pack("d", flt))