Floating-point constants can appear only in floating-point directives and in the floating-point load immediate instructions. Floating-point constants have the following format:
[[+|-]] d1 [[d2]] {e|E} [[+|-]] d3
Constant | Description |
d1 | Required. Written as a decimal integer and denotes the integral part of the floating-point value. |
d2 | Optional. Written as a decimal integer and denotes the fractional part of the floating-point value. |
d3 | Required. Written as a decimal integer and denotes a power of 10. |
Note The plus (+) and minus (-) symbols are optional. For example, the number .02173 can be represented as 21.73E-3
The floating-point directives (such as .float and .double) may optionally use hexadecimal floating-point constants instead of decimal constants. A hexadecimal floating-point constant consists of the following elements:
[[+|-]] 0x [[1|0]] hex-digits h0x hex-digits
The assembler places the first set of hexadecimal digits (excluding the 0 or 1 preceding the decimal point) in the mantissa field of the floating-point format without attempting to normalize it. It stores the second set of hexadecimal digits in the exponent field without biasing them. If the mantissa appears to be denormalized, it checks to determine whether the exponent is appropriate. Hexadecimal floating-point constants are useful for generating IEEE special symbols and for writing hardware diagnostics.
For example, both of the following directives generate the single-precision number 1.0:
.float 1.0e+0
.float 0x1.0h0x7f
The assembler uses normal (nearest) rounding mode to convert floating-point constants.