Time/Numbers

IEEE 754 Float Converter

Decimal number ↔ IEEE 754 binary representation (single or double precision) — sign, exponent, mantissa, special values.


            

Computers store fractional numbers in binary under the IEEE 754 standard — a sign, an exponent, and a mantissa, packed into a fixed number of bits. This tool shows that representation for any decimal number and parses it back into a number.

How to use it

Common uses

Things to keep in mind

Most decimal fractions (0.1, for example) have no exact binary representation — that's the root cause of the typical rounding errors seen in calculation results.

Comparing floating-point numbers for exact equality (===) is unreliable — check instead whether the difference is smaller than a small threshold (epsilon).

Article about this tool: IEEE 754: why 0.1 + 0.2 doesn't equal 0.3 in code

Frequently asked questions

What's the difference between single and double precision?

Single precision (float, 32 bits) gives about 7 decimal digits of precision, double precision (double, 64 bits) gives about 15-17. JavaScript's Number type uses double precision.

Why do some decimal numbers lose precision?

IEEE 754 stores numbers in binary, and many decimal fractions (like 0.1) have no exact finite binary representation — so the closest possible value is stored, with a tiny rounding error.

What do NaN, Infinity, and -0 mean?

NaN is the result of an invalid operation like 0/0. Infinity/-Infinity appear when a value overflows the representable range (e.g. dividing by 0). +0 and -0 are two different bit representations of signed zero, which are nonetheless equal as numbers.

What are subnormal (denormalized) numbers?

A special representation mode for numbers too small in magnitude for the normal format — the mantissa's implicit leading 1 is dropped, allowing a gradual approach toward zero instead of a sudden jump, at the cost of some precision.

How should I properly compare floating-point numbers instead of checking exact equality?

Instead of a === b, check whether the difference between the numbers is smaller than a small threshold (epsilon): Math.abs(a - b) < 1e-9. Exact equality is almost never guaranteed due to rounding errors.

Articles: Time/Numbers

Unix time: why computers count time from 1970

Why January 1, 1970 became the reference point for time in most computer systems.

Cron expressions: how to decode a task schedule

How to decode an expression like */15 * * * * and know exactly when the job will run.

Number systems: why binary, octal, and hexadecimal exist

Why the color #FF5733 in CSS is written in hexadecimal digits instead of decimal.

Bitwise operations: how AND, OR, and XOR work at the bit level

How bitwise AND differs from logical AND, and why you'd operate on individual bits of a number at all.

Date difference: why counting days is trickier than it looks

Why naively subtracting dates can give the wrong result because of leap years.

Age calculation: why it's not just subtracting years

Why simply subtracting birth years can give an age one year higher than the real one.

Time zones: why UTC isn't the same thing as GMT

Why UTC never changes twice a year, while London time (GMT/BST) does.

Duration calculator: how to correctly add up hours, minutes, and seconds

Why adding minutes and seconds requires "carrying" the remainder to the next place, just like in decimal addition.

ISO 8601 duration: how to write a duration in a standard format

Why PT1H30M means "1 hour 30 minutes," not "1 minute 30 hours."

Week number: why different countries count weeks differently

Why January 1 sometimes falls into week 52 or 53 of the previous year under the ISO 8601 standard.

Roman numerals: how a system with no zero and no place value works

Why IV means 4, not 6, and how the subtraction rule works in Roman numerals.

Number to words: why turn digits into text

Why bank documents write an amount both in digits and in words at the same time.