### Floating point numbers

It is eight and final part of**Say hello to x86_64 Assembly**and here we will take a look on how to work with non-integer numbers in assembler. There are a couple of ways how to work with floating point data: First of all let's look how floating point number stored in memory. There are three floating point data types:

- single-precision
- double-precision
- double-extended precision

*64-ia-32-architecture-software-developer-vol-1-manual*described:

The data formats for these data types correspond directly to formats specified in the IEEE Standard 754 for Binary Floating-Point Arithmetic.Single-precision floating-point float point data presented in memory:

- sign - 1 bit
- exponent - 8 bits
- mantissa - 23 bits

Exponent is either an 8 bit signed integer from −128 to 127 or an 8 bit unsigned integer from 0 to 255. Sign bit is zero, so we have positive number. Exponent is 00001111b or 15 in decimal. For single-precision displacement is 127, it means that we need to calculate

**exponent - 127**or

**15 - 127 = -112**. Since the normalized binary integer part of the mantissa is always equal to one, then in the mantissa is recorded only its fractional part, so mantissa or our number is

**1,110000000000000000000000**. Result value will be:

value = mantissa * 2^-112Double precision number is 64 bit of memory where:

- sign - 1 bit
- exponent - 11 bit
- mantissa - 52 bit

value = (-1)^sign * (1 + mantissa / 2 ^ 52) * 2 ^ exponent - 1023)Extended precision is 80 bit numbers where:

- sign - 1 bit
- exponent - 15 bit
- mantissa - 112 bit