I’d like to suggest: ``` fun Int.reinterpretAsFloa...
# stdlib
d
I’d like to suggest:
Copy code
fun Int.reinterpretAsFloat(): Float = java.lang.Float.intBitsToFloat(this)
fun Float.reinterpretAsInt(): Int = java.lang.Float.floatToIntBits(this)

fun Long.reinterpretAsDouble(): Double = java.lang.Double.longBitsToDouble(this)
fun Double.reinterpretAsLong(): Long = java.lang.Double.doubleToLongBits(this)
They are useful for binary serialization and for some floating point hacks/introspection. As far as I know it has been already implemented but with different API. Using toBits and Companion.fromBits to both Float and Double. Not sure which one is better. But I wanted to suggest this anyway :)