top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Why a 4-byte floating point number can actually hold fewer distinct values than a 4-byte integer?

+1 vote
411 views
Why a 4-byte floating point number can actually hold fewer distinct values than a 4-byte integer?
posted Apr 29, 2014 by Atul Mishra

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

If I got your question correctly, Integer variable has total 4 bytes (32 bits) to use where in case of float 3 bytes (24 bits) are used for decimal portal and remaining 1 byte to store the precision.

answer Apr 29, 2014 by Harshita
Similar Questions
+3 votes

Using fprintf() print a single floating point number right-justified in a field of 20 spaces, no leading zeros, and 4 decimal places. The destination should be stderr and the variable is called num.

+1 vote

Why the maximum and minimum exp values are 1024 and -1021?:

 >>> sys.float_info
sys.float_info(max=1.7976931348623157e+308, max_exp=1024, 
max_10_exp=308, min=2.2250738585072014e-308, min_exp=-1021, 
min_10_exp=-307, dig=15, mant_dig=53, epsilon=2.220446049250313e-16, 
radix=2, rounds=1)

The values (in double precision) 0 and 2047 are reserved for zero, infinity and NaN (in combination with the fraction), so I was expecting -1022 and 1023...

...