Bitwise Float To Int
-
29-10-2019 - |
Question
I am trying to figure out the algorithm to this but all I get with google is doing it with casting. I need to know the details.
So if we have a float x and want to return its binary representation what do we need to do?
I know we need to return the float if its NaN or a infinity but otherwise what are the steps?
EDIT
The function takes in an unsigned int, to be used as if it was a float, and then return the integer the number represents. I cannot use casting, just conditionals and bit-wise operators.
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow