Map a 32 bit float to a 32 bit integer

Posted by zounds on Stack Overflow See other posts from Stack Overflow or by zounds
Published on 2010-05-05T18:37:52Z Indexed on 2010/05/05 18:58 UTC
Read the original article Hit count: 511

Filed under:
|

Is there a way to map floats to ints or unsigned ints so that with the exception of NaN, order is preserved?

So if a and b are floats, and F is the mapping function,

a < b implies F(a) < F(b) and a == b implies F(a) == F(b)

© Stack Overflow or respective owner

Related posts about c++

Related posts about msvc++