(See info at bottom of page.)

Sign | Significand | Exponent | |||||||
---|---|---|---|---|---|---|---|---|---|

. | |||||||||

+ | 0.0 | 0 | |||||||

0x0000000000000000 | |||||||||

0b0000000000000000000000000000000000000000000000000000000000000000 | |||||||||

. | |||||||||

+ | 0.0 | 0 | |||||||

0x0000000000000000 | |||||||||

0b0000000000000000000000000000000000000000000000000000000000000000 | |||||||||

. | |||||||||

+ | 0.0 | 0 | |||||||

0x0000000000000000 | |||||||||

0b0000000000000000000000000000000000000000000000000000000000000000 |

This is a little calculator intended to help you understand the IEEE 754 standard for floating-point computation. It is implemented in JavaScript and should work with recent desktop versions of Chrome and Firefox. I haven't tested with other browsers. (And on Chrome it looks a bit ugly because the input boxes are a too wide.)

If you enter a floating-point number in one of the three boxes
on the left and press the *Enter* key, you will see the
number's bit pattern on the right. You can enter numbers
using the syntax typically accepted in programming languages,
for example `42`

, `2.345`

, `12E-3`

, and so on; you can input the values `NaN`

, `Inf`

, and `-Inf`

directly; and you can also enter fractions using the syntax `17/23`

. Finally, you can use as input bit patterns as shown on the right (the ones starting with `0b`

or `0x`

).

Or you can do it the other way around and manipulate the bits on the right. Once you've pressed *Enter*,
the number to the left will be updated. In the exponent
field, instead of a bit pattern you can also enter a decimal
starting with `+`

or `-`

. (Note
that the red digit is the *hidden bit* and can't be changed directly.)

Press one of the four buttons to add, subtract, multiply, or divide the two numbers above the buttons and show the result below.

The rounding mode used is *round to nearest, ties to even*.
The code doesn't distinguish between quiet and signaling `NaN`

, i.e. all `NaN`

s are quiet and use the same bit pattern.

The IEEE standard defines various binary and decimal formats. The default format for this page is *binary64*,
but you can use the buttons below to switch to some of the other variants.

Copyright (c) 2016, Prof. Dr. Edmund Weitz.