Mints version 1.18 now shows floating-point numbers in hex

When I released Mints 1.17 with its new Floating Point Explorer, I remarked that it might be even better to show and edit 32- and 64-bit floating-point numbers in hexadecimal. Warren kindly invited me to rise to that challenge, so here’s a new version that does just that.

When viewed in memory or on disk in raw hex format, floating-point numbers present two formidable challenges to their reading. First, we normally use floating-point numbers with a radix of 10, while their computer representations normally use a radix of 2. The number you and I know as π is around 3.14159274101257324 x 10^0, but in 64-bit floating-point it becomes 1.5707963705062866 x 2^1, which we simply wouldn’t recognise as π.

mints1183

Set in hexadecimal, though, it gets even worse, as it’s then 4009 21FB 6000 0000, but in 32-bit is 4049 0FDB, which appears quite unrelated.

mints1184

The reason for the complexity of hex representations of floating-point numbers is that their component parts don’t divide on byte boundaries. In 64-bit doubles, there’s a single sign bit followed by an 11-bit exponent and a 52-bit significand; in 32-bit singles, one sign bit is followed by 8 bits of exponent (so not aligned to byte boundaries), and a 23-bit significand.

I defy anyone to be able to just look at any floating-point number in hex format and read it off in radix 10 decimal form, apart from a few special examples like +0, which is at least all zeroes. Now, with this new version of Mints, you can work easily with radix 10 and 2, and with both 32- and 64-bit hex representations.

Simply enter your radix 10 number in the two boxes in the top row, and press the down cursor key, to see that number in radix 2 and in hex. To work in the opposite direction, enter your hex number in the box at the foot, and press the right cursor key to see it in radix 2 and 10 above. For your convenience, the hex can be entered in groups with whitespace between them, such as 4009 21FB 6000 0000, and if needed (which is unusual in floating-point) it will automatically be padded with leading zeroes.

While there are a few websites that will perform these conversions for you, Mints is always to hand and lets you explore further.

Mints version 1.18 is now available from here: mints118
from Downloads above, from its Product Page, and via its auto-update mechanism.

Enjoy!