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
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 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.
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.
thank you! very clear!
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.