BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
wxzhai
Obsidian | Level 7

Hi, I'm not very much understanding it in Windows: if length is 3 , why the largest integer represented exactly is 8,192? 

the mantissa is 12 bits ( 24 - 1 -11 = 12), so 2 ^12 = 4096. why it is 8,192?

 

thanks

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

Hi @wxzhai,

 

It is the so called "implied bit" (cf. Numeric Length in SAS®: A Case Study in Decision Making) that yields another factor 2: If the eleven exponent bits stand for an order of magnitude 2¹², the twelve mantissa bits run from 000000000000,  representing 2¹²=4096, through 111111111111, representing 2¹²+(2¹²−1)=8191. That is, the first "1" in the actual (mathematical) binary representation of those numbers is omitted (because it's redundant) to save one bit. Finally, 8192 has, again, all mantissa bits zero (like 4096 or any other power of 2), but the exponent increases by 1 to represent 2¹³. The next larger integer has mantissa bits 000000000001. Due to the increased exponent, this representation means 1.000000000001 [binary!] * 2¹³ = 8194, showing that 8193 cannot be represented with a length of 3 bytes, so in this sense (of consecutive integers) 8192 is the largest.

View solution in original post

4 REPLIES 4
Tom
Super User Tom
Super User

@wxzhai wrote:

Hi, I'm not very much understanding it in Windows: if length is 3 , why the largest integer represented exactly is 8,192? 

the mantissa is 12 bits ( 24 - 1 -11 = 12), so 2 ^12 = 4096. why it is 8,192?

 

thanks


The most significant bit is not stored.  It is implied.

wxzhai
Obsidian | Level 7
thank you!
FreelanceReinh
Jade | Level 19

Hi @wxzhai,

 

It is the so called "implied bit" (cf. Numeric Length in SAS®: A Case Study in Decision Making) that yields another factor 2: If the eleven exponent bits stand for an order of magnitude 2¹², the twelve mantissa bits run from 000000000000,  representing 2¹²=4096, through 111111111111, representing 2¹²+(2¹²−1)=8191. That is, the first "1" in the actual (mathematical) binary representation of those numbers is omitted (because it's redundant) to save one bit. Finally, 8192 has, again, all mantissa bits zero (like 4096 or any other power of 2), but the exponent increases by 1 to represent 2¹³. The next larger integer has mantissa bits 000000000001. Due to the increased exponent, this representation means 1.000000000001 [binary!] * 2¹³ = 8194, showing that 8193 cannot be represented with a length of 3 bytes, so in this sense (of consecutive integers) 8192 is the largest.

wxzhai
Obsidian | Level 7

thank you! very clear!

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 901 views
  • 4 likes
  • 3 in conversation