public static function encode(Float64 $float)
    {
        if ($float->isZero())
        {
            $sign = 0;
            $exponent = 0;
            $significand = 0;
        }

        else if ($float->isInfinity())
        {
            $sign = $float->getSign();
            $exponent = static::getMaxExponent();
            $significand = 0;
        }

        else if ($float->isNaN())
        {
            $sign = 0;
            $exponent = static::getMaxExponent();
            $significand = static::padSignificand(1);
        }

        // Value fits as a normal 16 bit float
        else if (static::fitsAsNormal($float))
        {
            $sign = $float->getSign();
            $exponent = $float->getExponent() + self::getExponentOffset();
            $significand = static::padSignificand($float->getSignificand());
        }

        // Must be a subnormal
        else
        {
            $sign = $float->getSign();
            $exponent = 0;

            // Grab the significand without the leading zeros
            $significand = $float->getSignificand();

            // Convert the significand into a binary string
            $significand = decbin($significand);

            // Trim leading zeros
            $significand = ltrim($significand, '0');

            // Add a 1 to the start of the string, it's implicit in normal numbers, but not in subnormals
            $significand = '1' . $significand;

            // Get the distance the first significant digit should be from the 0 point
            $exponentAddOn = abs($float->getExponent() + self::getExponentOffset());

            // Add that many zeros on the left
            $significand = str_repeat('0', $exponentAddOn) . $significand;

            // Pad the rest with zeros on the right and convert to decimal
            $significand = bindec(static::padSignificand($significand));
        }

        // Make second byte
        $second = (($sign << 7) & 0b10000000) | (($exponent << 2) & 0b01111100) | (($significand >> 8) & 0b11);

        // And the third
        $third = $significand & 255;

        return static::encodeFirstByte() . pack(PackFormat::UINT_8, $second) . pack(PackFormat::UINT_8, $third);
    }