In: Computer Science
Describe how zero, infinity, and NaN are stored in IEEE 754 floating point formats
IEEE 754 standards:
· This is a technical standard for floating point operations.
· Established in the year 1985
· By, IEEE, the Institute of Electrical and Electronics Engineers
· IEEE has reserved some values for solving the uncertainty issues.
· They are ZERO, INFINITY, NaN
According to IEEE 754, the floating points numbers are represented using 3 components:
1. Sign of mantissa
This is to denote whether the floating point number is a positive or a negative number.
0 represent positive numbers, while 1 represent a negative number.
2. Exponent field:
This field is to represent the negative and positive exponents of the floating point number.
3. Mantissa:
This field has all the significant digits of the floating point number represented.
Also these fields are only filled with binary values, 0 and 1.
----------------------------------------------------------------------------------------------------------------------------------------------------------
ZERO:
· Here the exponent and mantissa are filled with value 0
· According to this standard, +0 and -0 are distinct, even if they have equal value.
· The sign bit varies for the + and – infinity.
The bit representation of zero can be like:
+0.0 = 0 00000000 00000000000000000000000
-0.0 = 1 00000000 00000000000000000000000
INFINITY:
· Here exponents are all 1’s
· Mantissa all 0’s
· The +infinity and – infinity are represented distinctively
· The sign bit value helps to identify whether it’s positive or a negative infinity.
The bit representation of two kinds of infinity are:
+Infinity= 0 11111111 00000000000000000000000
- Infinity = 1 11111111 00000000000000000000000
NaN:
· Not-A-Number
· This is to represent an error number value.
· NaN, can be the results of operations like 0/0, infinity/infinity, infinity-infinity, or infinity*0.
· Here exponent fields are all 1, with 0 sign bit
· mantissa with 1 followed by all zeros
· there are different kinds of NaN like, Quiet NaN or qNaN
· and also Signalling NaN or sNaN
. the bit representation of common NaN is like:
Nan= 0 11111111 10000000000000000000000
·
·