Is there any way to get the binary representation of a floating point number in PHP? Something like Java’s Double.doubleToRawLongBits().
Given a positive floating point number, I’d like to get the largest representable floating-point number which is less than that number. In Java, I can do it like this:
double x = Double.longBitsToDouble(Double.doubleToRawLongBits(d) - 1);
But I’m not seeing anything similar in PHP.
This isn’t a full answer, but the only way I know of to put a float into binary is with pack()