2.3
Storing real values: floating point (2.3) is a Class 9 Computer Science lesson for the Punjab boards. It walks through the idea in plain steps, then sets a short check, in English, Urdu or Roman Urdu.
Your guide: Miss HiraExplains computers with chai, cricket and your phone.
Chapter 1 of every subject is free. Unlock every chapter of this class with the full course.
Unlock full courseAlready paid? Sign in with the Google account you paid with.
Real values (floating-point numbers) have fractions. They are stored like scientific notation: sign × mantissa × 2^exponent. For example 5.75 = 1.4375 × 22.
To turn a decimal fraction into binary, multiply the fraction by 2 and write the integer part; repeat with the new fraction until it is 0. 0.375 → 0.75 (0), 1.5 (1), 1.0 (1), so 0.375 = 0.0112.
Single precision uses 32 bits: 1 sign, 8 exponent (bias 127), 23 mantissa; range about 1.4 × 10−45 to 3.4 × 1038. Double precision uses 64 bits with an 11-bit exponent (bias 1023, exponent −1022 to +1023). Round-off errors must be watched.
Step 1 / 1
Real values (floating-point numbers) have fractions. They are stored like scientific notation: sign × mantissa × 2^exponent. For example 5.75 = 1.4375 × 22.
To turn a decimal fraction into binary, multiply the fraction by 2 and write the integer part; repeat with the new fraction until it is 0. 0.375 → 0.75 (0), 1.5 (1), 1.0 (1), so 0.375 = 0.0112.
Single precision uses 32 bits: 1 sign, 8 exponent (bias 127), 23 mantissa; range about 1.4 × 10−45 to 3.4 × 1038. Double precision uses 64 bits with an 11-bit exponent (bias 1023, exponent −1022 to +1023). Round-off errors must be watched.
Stored exponent = real exponent + 127 (single).
Found a mistake? Tell us the lesson and the line at exciting@boringeducation.com.
No ads. Tell us what to fix.