Single more 'powerful' than Integer although both use same amount of bytes ???

C

Chris

Hi,

a Single and Integer variable each take 4 bytes.
(check on :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vagrpdatatype.asp)

But how come then that the range for valid values for an integer is
-2,147,483,648 through 2,147,483,647
(OK: 2pow32 = 4,294,967,296 e09 different posibillities )

and for a single

-3.4028235E+38 through -1.401298E-45 for negative values
1.401298E-45 through 3.4028235E+38 for positive values.

so many more values with the same amount of 32 bits ????

Any logical explanation for this ?

thnx

Christian
 
A

Armin Zingler

Chris said:
Hi,

a Single and Integer variable each take 4 bytes.
(check on :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vagrpdatatype.asp)

But how come then that the range for valid values for an integer
is
-2,147,483,648 through 2,147,483,647
(OK: 2pow32 = 4,294,967,296 e09 different posibillities )

and for a single

-3.4028235E+38 through -1.401298E-45 for negative values
1.401298E-45 through 3.4028235E+38 for positive values.

so many more values with the same amount of 32 bits ????

Any logical explanation for this ?


3.4028235E+38 is a large number, but the first ~30 decimal places are zero.
In other words, in opposite to an integer value, the step size for a high
single value is not 1 but it is 1E+38, so there are "some" numbers between
missing (higher numbers->less accuracy). The total number of different
Integer values is (at least approximately) equal to the total number of
different Single values.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top