This question is probably "unusual", but I need to cast a float Number
to an integer Number
, without modifying its binary representation.
For example, the float 37.5
is represented by the bytes 0x42160000
(according to IEEE 754).
I need to reinterpret 0x42160000
as an integer, i.e. the number 1108738048
How do I do this? I'm thinking there could be some bitwise tricks to accomplish this?
To be clear, I'm not looking for Math.round
or parseInt
.