IEEE 754 Representation

Enter a number to convert

Enter the exponent to build a custom precision
Enter the mantissa to build a custom precision

Summary

  • Number 0
  • Edge Case True
  • Sign Bit 1
  • Exponent Bits 5
  • Mantissa Bits 10
  • Total Bits 16
  • Sign 0
  • Scale
  • Scaled Number
  • Scaled Number In Binary
  • Unable To Scale No
  • Bias 15
  • Bias In Binary 01111
  • Exponent 00000
  • Mantissa 0000000000
  • Mantissa Base 10
  • Result 0 00000 0000000000
  • Hexadecimal 0000
  • Hexadecimal Parts 0000 0000 0000 0000
  • Converted Number
  • Error

Determine the Sign Bit

  • Sign bit is either 0 or 1 for positive and negative numbers, respectively

0 > 0 → 0

Sign = 0

Scale up the Number to Integer

  • Multiply the number by 2
  • Repeat until the number is an integer
  • Count the number of multiplications
  • Save the integer number for later use

Calculate the Bias

  • Find the minimum and maximum exponent
  • Leave the minimum exponent for later use
  • Leave the maximum exponent for later use
  • Count the possible exponent values between the minimum and maximum
  • Divide the possible exponent values by 2
  • Get the middle value as the bias
or
Use the following formula to calculate the bias directly:

Bias = 2Number of Exponent Bits - 1 - 1

Bias = 25 - 1 - 1 = 24 - 1 = 16 - 1

Bias = 15

Calculate the Exponent

  • Convert the scaled up number to binary
  • Normalize the binary number by leaving only one digit before the decimal point
  • Count the number of digits after the decimal point
  • Exponent is the sum of this count and the bias subtracted by the scale
  • Convert the sum to binary
  • Truncate the result to the desired precision
  • Pad the result with 0s to the desired precision

Exponent = 00000

Calculate the Mantissa

  • Convert the scaled up number to binary
  • Normalize the binary number by leaving only one digit before the decimal point
  • The mantissa is the fraction part of the normalized binary number
  • Truncate the result to the desired precision
  • Round up the last digit to 1 if the number is truncated
  • Pad the result with 0s to the desired precision

Mantissa = 0000000000

Build IEEE 754 Representation

  • Sign Bit 0
  • Exponent Bits 00000
  • Mantissa Bits 0000000000
  • 0 00000 0000000000

Convert to Hexadecimal

  • Complete the length of bits to a multiple of 4 by padding 0s to the left if necessary
  • Split the bits to include 4 digits in each group
  • Convert each group to hexadecimal

0000 0000 0000 0000

0 0 0 0

Hex: 0000

Calculate the Error

  • Convert the IEEE 754 representation back to float
  • Calculate the error by subtracting the converted number from the original number