Floating point numbers explorer
Calculator shows internal representation of IEEE 754 floating point numbers, as it is stored in computer's memory. You can see binary, hexadecimal and decimal dump of the number including split into sign, exponent and mantisa parts. Both single and double floating numbers are supported.

# Beta version

BETA TEST VERSION OF THIS ITEM
This online calculator is currently under heavy development. It may or it may NOT work correctly.
You CAN try to use it. You CAN even get the proper results.
However, please VERIFY all results on your own, as the level of completion of this item is NOT CONFIRMED.
Feel free to send any ideas and comments !
 Data type IEEE 754 single-precision (32-bit)IEEE 754 double-precision (64-bit) Decimal representation Hexadecimal representation Binary representation

# Binary dump part-by-part

Sign (1 bit)Exponent (11 bit)Mantisa (52 bit)
Bin
Hex
Dec

# Some facts

• Floating point number is a data type used to represent real numbers in computer memory.
• Because the amount of computer memory is limited, floating point numbers are only an approximation of real numbers.
• There are many various floating point number standards, but most common is IEEE 754 today.
• The number in IEEE 754 system is represented in below form:
$-1^{s} \times m \times 2^{e}$
where:
• s = sign bit,
• m = mantisa in base-2 (binary system),
• e = exponent, which tells "where is decimal point".
• Compared to fixed-point numbers, floating-point numbers allow to write numbers from a larger range, but with reduced precision.
• The IEEE 754 standard defines below data types:
• single precision (32-bit):
• sign - 1 bit,
• exponent - 8 bits,
• mantisa - 23 bits,
• double precision (64-bit):
• sign - 1 bit,
• exponent - 11 bits,
• mantisa - 52 bits.
• extended precision (80-bit):
• sign - 1 bit,
• exponent - 15 bits,
• mantisa - 64 bits.
• The IEEE 754 standard defines below rounding modes:
• round to nearest,
• round toward 0,
• round toward +infinity,
• round toward -infinity.
• Default rounding-mode in IEEE 754 system is rounding to the nearest vaulue.

# x87 coprocessor vs SIMD unit

• Computers based on x86 (IA-32) family, usually implement floating point numbers using x87 coprocessor, when x64 (64-bit code) often use SIMD unit for this (SSEx instruction set).
• x87 coprocessor internally uses 80-bit numbers, when precision of SIMD registers are limited to 64-bits. This fact may cause slightly different results depending on whether we use the x64 (64-bit) or x86 (32-bit) architecture.
• To show differences, which may occur depending on target architecture, we can use below program written in C language:
#include <stdio.h>#include <stdint.h>void printFloat(float x){ uint32_t hex = *(uint32_t *) &x; printf("%.8f = 0x%08x\n", x, hex);}void printFloatRational(int x, int y){ float res = (float) x / y; uint64_t hex = *(uint32_t *) &res; printf("%d / %d = %.8f = 0x%08x\n", x, y, res, hex);}int main(){ printFloatRational(1, 3); printFloatRational(10, 30); printFloatRational(100, 300); printFloatRational(1000, 3000); printFloatRational(12345678, 87654321); printFloatRational(87654321, 12345678); printFloatRational(12345678, 87654321); printFloatRational(12354124, 54123903); printFloat(0.33333333f); printFloat(0.5f); printFloat(0.12345678f); printFloat(0.87654321f); printFloat(12345678.12345678f);}

Above code, when compiled using gcc 7.2.0 64-bit, gives below result:
1 / 3 = 0.33333334 = 0x3eaaaaab10 / 30 = 0.33333334 = 0x3eaaaaab100 / 300 = 0.33333334 = 0x3eaaaaab1000 / 3000 = 0.33333334 = 0x3eaaaaab12345678 / 87654321 = 0.14084506 = 0x3e1039b087654321 / 12345678 = 7.10000038 = 0x40e3333412345678 / 87654321 = 0.14084506 = 0x3e1039b012354124 / 54123903 = 0.22825633 = 0x3e69bc070.33333334 = 0x3eaaaaab0.50000000 = 0x3f0000000.12345678 = 0x3dfcd6e90.87654322 = 0x3f60652312345678.00000000 = 0x4b3c614e

when the same code, compiled using gcc 4.9.3 32-bit, gives below one:
1 / 3 = 0.33333334 = 0x3eaaaaab10 / 30 = 0.33333334 = 0x3eaaaaab100 / 300 = 0.33333334 = 0x3eaaaaab1000 / 3000 = 0.33333334 = 0x3eaaaaab12345678 / 87654321 = 0.14084506 = 0x3e1039b087654321 / 12345678 = 7.10000038 = 0x40e3333412345678 / 87654321 = 0.14084506 = 0x3e1039b012354124 / 54123903 = 0.22825634 = 0x3e69bc080.33333334 = 0x3eaaaaab0.50000000 = 0x3f0000000.12345678 = 0x3dfcd6e90.87654322 = 0x3f60652312345678.00000000 = 0x4b3c614e

• Small difference in division result:
12354124 / 54123903
is related with fact, that 32-bit code generated by gcc uses x87 coprocessor:
fild DWORD PTR [ebp+8] ; load 12354124 onto x87 stack (80 bit)fild DWORD PTR [ebp+12] ; load 54123903 onto x87 stack (80 bit)fdivp st(1), st ; calculate 12354124 / 54123903

when 64-bit code uses SIMD unit:
cvtsi2ss xmm0, DWORD PTR 16[rbp] ; load 12354124 to xmm0 registercvtsi2ss xmm1, DWORD PTR 24[rbp] ; load 54123903 to xmm1 registerdivss xmm0, xmm1 ; calculate 12354124 / 54123903