r/computerscience • u/Weenus_Fleenus • Jun 10 '25
why isn't floating point implemented with some bits for the integer part and some bits for the fractional part?
as an example, let's say we have 4 bits for the integer part and 4 bits for the fractional part. so we can represent 7.375 as 01110110. 0111 is 7 in binary, and 0110 is 0 * (1/2) + 1 * (1/22) + 1 * (1/23) + 0 * (1/24) = 0.375 (similar to the mantissa)
31
Upvotes
View all comments
Show parent comment
6
u/Headsanta Jun 10 '25
This is an optimization due to the representation being in binary. In binary, every number in scientific notation must have a first digit as 1 so IEEE
(0.11)*101 *all numbers in binary, decimal equivalent 0.75 * 2
Is equal to 1.1*100
So you don't have to write that first 1 if every number will have it. It let's you get an extra bit.