Multiplying floating point numbers (IEEE 754)

required files are loaded...
settings:
URL copied

About the calculator

This calculator can be used to multiply 2 binary IEEE-754 floating point numbers. You can select whether the input numbers are binary floating point numbers in binary or hexadecimal representation or whether they are decimal numbers. If they are decimal numbers, they are converted into binary floating point numbers before multiplication.

important values:

data typesizeexponentmantissebias
binary1616 bits5 bits10 bits15
binary3232 bits8 bits23 bits127
binary6464 bits11 bits52 bits1023
binary128128 bits15 bits112 bits16383

Multiplication of binary floating point numbers

2 numbers that are in binary IEEE-754 floating point format can be multiplied using the following steps:

  1. Convert exponents to decimal numbers
  2. Prepend implicit 1 to mantissas
  3. Determine sign
  4. Add exponents and subtract bias
  5. Multiply mantissas
  6. Normalization
  7. Rounding
  8. Convert exponent to binary number
  9. Assemble floating point number

To illustrate the procedure, the following 2 binary floating point numbers should be added together:

01000010111100011000000000000000

and

11000001011001000000000000000000

1. Convert exponents to decimal numbers:

In the first step, the exponents of both numbers are converted into decimal numbers. Alternatively, you can subtract the bias. However, this is not necessary and is not done in the example.

number 1:
100001012 = 128 + 4 + 1 = 133

number 2:
100000102 = 128 + 2 = 130

2. Prepend implicit 1 to mantissas:

A "1." is written in front of each mantissa.

number 1:
1.11100011000000000000000

number 2:
1.11001000000000000000000

In combination with the exponents and the sign bits, the numbers are thus:

number 1:
1.111000112 ∙ 2133 − bias

number 2:
−1.110012 ∙ 2130 − bias

3. Determine sign

If the sign bits of the two factors are the same, then the product is positive and the sign bit is therefore 0. Otherwise the product is negative and the sign bit is therefore 1.

The sign bits are different. The sign bit of the solution is therefore 1.

4. Add exponents and subtract bias

Next, the two exponents are added together. If the bias was not subtracted from the exponents in step 1, then the bias must be subtracted from the sum. If the bias was already subtracted in step 1, it is not subtracted from the sum in this step.

133 + 130 − bias = 133 + 130 − 127
 = 263 − 127
 = 136

5. Multiply mantissas

The two mantissas are then multiplied. In principle, multiplying binary numbers works in the same way as multiplying decimal numbers.

Each digit of the second number is multiplied by the first number. The products are either 0 or the first number itself. The products are written one below the other in such a way that as many places are left free behind them as there are places behind the corresponding digit of the second factor. If you start with the last digit of the second factor, then each product is moved one place further to the left than the previous product.

Then for each column the values are added together, from the rightmost column. If the sum of a column is 0 or 1, it is written to the solution. Otherwise, the sum is converted into a binary number, the last digit is written to the solution and the digits before the last digit are converted to a decimal number and written to the row for the carry one column to the left. For example, if the sum of a column is 9, then the binary number is 10012. The last 1 is written to the solution and the 1002 is converted to a decimal number ( this gives 4) and written to the row for the carryovers one column to the left. The binary point of the solution is set so that the solution has as many fractional digits as the two factors together.

Multiply the digits of the second number by the first number:

each digit of the mantissa of the second number is multiplied by the mantissa of the first number

Add up columns:

Multiplying the mantissas of the IEEE-754 numbers

The first number has 8 fractional digits and the second has 5, so the solution has 13 fractional digits.

The product of the binary numbers has as many fractional digits as the two binary numbers together.

The solution of the multiplication is therefore:
−11.01011100010112 ∙ 2136 − bias

6. Normalization

If the binary point is no longer behind the first 1 after multiplication, it must be shifted there. Shifting the binary point also changes the exponent. If the binary point is shifted to the left, the exponent is increased by the number of places that the binary point is shifted and if the binary point is shifted to the right, it is reduced by the number of places that the binary point is shifted to the right.

The binary point must be shifted one place to the left. The exponent must therefore be increased by 1.

−1.101011100010112 ∙ 2137 − bias

7. Rounding

If the number has more fractional digits than the binary floating point number can store, it must be rounded. In most cases, it is rounded to the nearest representable number. The bit after the least significant bit (the last bit that can be stored in the mantissa of the floating point number) is looked at for this purpose. If there is a 1 directly after the least significant bit and it is not followed by a 1 in at least one other place, then the number lies exactly in the middle between 2 representable numbers. In this case, the number is rounded so that the least significant bit is 0. If there is a 1 in the bit after the least significant bit and this is followed by a 1 in at least one further place, then the number with the greater absolute value is the nearest representable number. If the least significant bit is followed by a 0, then the number with the smaller absolute value is the nearest number that can be represented.

In the example, the number has 14 fractional digits. The mantissa of a binary floating point number with 32 bits has space for 23 bits. Therefore, the number does not need to be rounded.

8. Convert exponent to binary number

The exponent is converted into a binary number. If the bias was subtracted in step 1, it must be added beforehand.

137 is converted into a binary number: 100010012

9. Assemble floating point number

Finally, all components are combined to form a binary floating point number in the IEEE-754 standard.

The sign bit was determined in step 3.

The exponent bits calculated in step 8 are written to the exponent part. If the exponent bits are not sufficient to completely fill the exponent part, the exponent part is filled with zeros at the front.

The fractional digits of the normalized and rounded number are written to the mantissa part of the floating point number. If there are still free bits in the mantissa part, it is filled with zeros at the end.

The solution is:
11000100110101110001011000000000

good explanatory videos on Youtube

Share:FacebookTwitter