private static function encodeDouble($double)
    {
        // Make a 64 bit float out of the double
        $float = new Float64($double);

        // Can be exactly represented by a 16 bit float
        if (Float16::fits($float))
        {
            // Create the byte string
            return Float16::encode($float);
        }

        // Can be exactly represented by a 32 bit float, or a 32 bit subnormal
        else if (Float32::fits($float))
        {
            return Float32::encode($double);
        }

        // Must be a 64 bit float
        else
        {
            return Float64::encode($double);
        }
    }
private static function encodeDouble($double)
    {
        // Make a 64 bit float out of the double
        $float = new Float64($double);

        // Can be exactly represented by a 16 bit float
        if (Float16::fits($float))
        {
            // Create the byte string
            return Float16::encode($float);
        }

        // Can be exactly represented by a 32 bit float, or a 32 bit subnormal
        else if (Float32::fits($float))
        {
            return Float32::encode($double);
        }

        // Must be a 64 bit float
        else
        {
            return Float64::encode($double);
        }
    }
private static function encodeDouble ( $ double ) { // Make a 64 bit float out of the double $ float = new Float64 ( $ double ) ; // Can be exactly represented by a 16 bit float if ( Float16 :: fits ( $ float ) ) { // Create the byte string return Float16 :: encode ( $ float ) ; } // Can be exactly represented by a 32 bit float, or a 32 bit subnormal else if ( Float32 :: fits ( $ float ) ) { return Float32 :: encode ( $ double ) ; } // Must be a 64 bit float else { return Float64 :: encode ( $ double ) ; } }
Encodes a double into a CBOR string.

@param float $double The double to encode.
@return string The encoded byte string.
Encodes a double into a CBOR string .