-
Notifications
You must be signed in to change notification settings - Fork 70
4. IEEE 754 Representation
Bora Canbula edited this page Nov 25, 2023
·
1 revision
IEEE 754 is a technical standard for floating point arithmetic established in 1985 by the Institute of Electrical and Electronics Engineers (IEEE), see Wikipedia.
IEEE 754 representation consists of three parts, namely, sign, exponent, and mantissa. Sign part always takes one bit to show the positivity or negativity of the number. On the other hand, the length of the exponent and the mantissa parts defines the precision of the representations.
Precision | Sign | Exponent | Mantissa | Total |
---|---|---|---|---|
Half | 1 | 5 | 10 | 16 |
Single | 1 | 8 | 23 | 32 |
Double | 1 | 11 | 52 | 64 |
Quad | 1 | 15 | 112 | 128 |
Octuple | 1 | 19 | 236 | 256 |
You can convert any floating point number into IEEE 754 representation with a predefined or custom precision by using ieee754
package.
from ieee754 import double
double(13.375)
You can also find the further details about the conversion procedure in the web application, which has been written in this course as a side project.