| UMBC CMSC 313 |
The reality of things is that very few people do any real work in assembly language with floating point numbers. There is not a lot of material that explains it either.
The floating point numbers can be in one of five separate forms:
| type | C equivalent | size (in bits) |
|---|---|---|
| short floating point | float | 32 |
| long floating point | double | 64 |
| integer (DW) | short int | 16 |
| long integer (DD) | long int | 32 |
| Binary Coded Decimal (BCD) | NONE | 4 |
| *extended floating point | NONE | 80 |
* Internal format only
There are three components in the long floating point:
The exponent is biased. That is value is in the range of -1023 to 1024. The bias is 1023, when added to the exponent results in a positive number. (If the exponent is 3, then 1026 is stored as the exponent portion of the floating point number.)
The mantissa the the part of the number that hold the value we are talking about, except that it is normalized. In scientific notation, all numbers are multiplied or divided by ten so that there is only one digit in front of the decimal sign. The exponent is adjusted to compensate for that. 1.23 X 102 is the equivalent of 1.23 X 100. (102 is 100). 1.23 X 100 is 123 when you multiple it out.
In the binary system, we change the power of ten to the power of two. This means that the value when we have a non-zero digit in front of decimal point, it must be a one. Therefore we don't need it, we can assume that it is present!
This means the number is represented as:
| decimal digits of precision | range of exponent | |
|---|---|---|
| short | 7 | 10-38 to 1038 |
| long | 15 | 10-308 to 10308 |
| extended | 19 | 10-4932 to 104932 |
There are two terms that we must understand here, precision and accuracy Precision is the number of digits represented starting with the first non-zero number. 123, -123, 123000, 0.123, and -0.000123 all have a precision of 3. Accuracy is the total number of digits in the value you are trying to represent correctly. 3.140000 could be a seven digit precision but only 3 place accuracy.
A4 DD -1.23 ; A negative short fp number
B4 DD 54E23 ; A positive short fp number
C4 DD -5432 ; A negative long integer
D4 DD ? ; A variable which can hold either
; a short fp or long integer
E8 DQ -1.23 ; A negative long fp number
Decimal digits are coded, two digits per byte.
A DT -12345
