Binary representation of integers and floating point numbers: is there a monotonically increasing one-to-one correspondence? -


dealing legacy system in need store integers using function accepts doubles input, came accross following problem. given binary number, example:

00111111 11000000 00000000 00000000

if represent integer number 1069547520. if represent ieee 754 floating point number 1.5. easy see there one-to-one correspondence between integers , ieee 754 floating point numbers. question following. given 2 integers , b, , corresponding ieee 754 floating point counterparts , b, > b imply > b?

i guess answer yes, lack strong arguments supporting it. hint?

positive ieee 754 binary32 numbers map increasing integers.

however:

  • the ieee 754 representation sign-magnitude, negative binary32 numbers map decreasing integers. if mapped unsigned int32s, negative floating-point numbers map above positive floating-point numbers (and if going bit-twiddle floating-point numbers, may map them unsigned int32s).

  • ieee 754 has +0.0 , -0.0, equal floating-point definition of “equal” map different integers (respectively 0 and, if mapping signed 32-bit int type, int_min).

  • ieee 754 has several representations of nan, map different integers.

  • this assumes floating-point , integer representations have same endianness. there many advantages in giving them same endianness, arm, cite example, has historically been doing strange things endianness, should point out.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -